RFR: 8287525: Extend IR annotation with new options to test specific target feature.

Vladimir Kozlov kvn at openjdk.java.net
Thu Jun 2 18:20:25 UTC 2022


On Thu, 2 Jun 2022 17:17:21 GMT, Swati Sharma <duke at openjdk.java.net> wrote:

> Hi All,
> 
> Currently test invocations are guarded by @requires vm.cpu.feature tags which are specified as the part of test tag specifications. This results into generating multiple test cases if some test points in a test file needs to be guarded by a specific features while others should still be executed in absence of missing target feature. 
> 
> This is specially important for IR checks based validation since C2 IR nodes creation may heavily rely on existence of specific target feature. Also, test harness executes test points only if all the constraints specified in tag specifications are met, thus imposing an OR semantics b/w @requires tag based CPU features becomes tricky.
> 
> Patch extends existing @IR annotation with following two new options:-
> 
> - applyIfTargetFeatureAnd:
> Accepts a list of feature pairs where each pair is composed of target feature string followed by a true/false value where a true value necessities existence of target feature and vice-versa. IR verifications checks are enforced only if all the specified feature constraints are met.
> - applyIfTargetFeatureOr: Accepts similar arguments as above option but IR verifications checks are enforced only when at least one of the specified feature constraints are met.
> 
> Example usage:
>     @IR(counts = {"AddVI",  "> 0"}, applyIfTargetFeatureOr = {"avx512bw", "true", "avx512f", "true"})
>     @IR(counts = {"AddVI",  "> 0"}, applyIfTargetFeatureAnd = {"avx512bw", "true", "avx512f", "true"})
> 
> Please review and share your feedback.
> 
> Thanks,
> Swati

test/hotspot/jtreg/compiler/lib/ir_framework/IR.java line 106:

> 104:      * IR verifications checks are enforced only if all the specified feature constraints are met.
> 105:      */
> 106:     String[] applyIfTargetFeatureAnd() default {};

Why you used `Target` instead of original `CPU` (you check output of `getCPUFeatures()` only)?
Do you plan to extend this to check flags too in a future?

test/hotspot/jtreg/compiler/lib/ir_framework/IR.java line 110:

> 108:      /**
> 109:      * Accepts a list of feature pairs where each pair is composed of target feature string followed by a true/false
> 110:      * value where a true value necessities existence of target feature and vice-versa.

I don't think you need to repeat the same 2 lines.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8999


More information about the hotspot-compiler-dev mailing list