8309697: [TESTBUG] Remove "@requires vm.flagless" from jtreg vectorization tests

Reviewed-by: shade
Backport-of: a03954e6c5
This commit is contained in:
Goetz Lindenmaier
2024-02-05 12:38:47 +00:00
committed by Vitaly Provodin
parent bd3d991648
commit 716df002bd
23 changed files with 61 additions and 47 deletions

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayCopyTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* compiler.vectorization.runner.ArrayIndexFillTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,9 +35,14 @@
* -XX:+WhiteBoxAPI
* -XX:-OptimizeFill
* compiler.vectorization.runner.ArrayInvariantFillTest
* @run main/othervm -Xbootclasspath/a:.
* -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI
* -XX:+OptimizeFill
* compiler.vectorization.runner.ArrayInvariantFillTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;
@@ -66,7 +71,11 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
// ---------------- Simple Fill ----------------
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_B, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_B, "0"})
public byte[] fillByteArray() {
byte[] res = new byte[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -77,7 +86,11 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_S, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_S, "0"})
public short[] fillShortArray() {
short[] res = new short[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -88,7 +101,11 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_S, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_S, "0"})
public char[] fillCharArray() {
char[] res = new char[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -99,7 +116,11 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_I, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_I, "0"})
public int[] fillIntArray() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -121,7 +142,11 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_F, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_F, "0"})
public float[] fillFloatArray() {
float[] res = new float[SIZE];
for (int i = 0; i < SIZE; i++) {
@@ -177,7 +202,11 @@ public class ArrayInvariantFillTest extends VectorizationTestRunner {
@Test
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "false"},
counts = {IRNode.REPLICATE_I, ">0"})
@IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
applyIf = {"OptimizeFill", "true"},
counts = {IRNode.REPLICATE_I, "0"})
public int[] fillIntArrayWithDouble() {
int[] res = new int[SIZE];
for (int i = 0; i < SIZE; i++) {

View File

@@ -36,7 +36,7 @@
* compiler.vectorization.runner.ArrayShiftOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayTypeConvertTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.ArrayUnsafeOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicBooleanOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -38,7 +38,7 @@
* -XX:LoopUnrollLimit=1000
* compiler.vectorization.runner.BasicByteOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicCharOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* compiler.vectorization.runner.BasicDoubleOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* compiler.vectorization.runner.BasicFloatOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicIntOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -37,7 +37,7 @@
* compiler.vectorization.runner.BasicLongOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.BasicShortOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -37,7 +37,7 @@
* compiler.vectorization.runner.LoopArrayIndexComputeTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;
@@ -277,7 +277,7 @@ public class LoopArrayIndexComputeTest extends VectorizationTestRunner {
byte[] res = new byte[SIZE];
System.arraycopy(bytes, 0, res, 0, SIZE);
for (int i = 0; i < SIZE / 2; i++) {
res[i] *= bytes[i + 3];
res[i] += bytes[i + 3];
}
return res;
}

View File

@@ -36,7 +36,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopCombinedOpTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -35,7 +35,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopControlFlowTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopLiveOutNodesTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,8 +36,8 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.LoopRangeStrideTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires (os.arch=="amd64" | os.arch=="x86_64" | os.simpleArch == "aarch64")
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* compiler.vectorization.runner.LoopReductionOpTest
*
* @requires (os.simpleArch == "x64") | (os.simpleArch == "aarch64")
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*
*/

View File

@@ -36,7 +36,7 @@
* -XX:+WhiteBoxAPI
* compiler.vectorization.runner.MultipleLoopsTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -36,7 +36,7 @@
* -XX:LoopStripMiningIter=10
* compiler.vectorization.runner.StripMinedLoopTest
*
* @requires vm.compiler2.enabled & vm.flagless
* @requires vm.compiler2.enabled
*/
package compiler.vectorization.runner;

View File

@@ -25,18 +25,11 @@ package compiler.vectorization.runner;
import compiler.lib.ir_framework.*;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.io.File;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
import jdk.test.whitebox.WhiteBox;
@@ -51,17 +44,14 @@ public class VectorizationTestRunner {
private static final int NMETHOD_COMP_LEVEL_IDX = 1;
private static final int NMETHOD_INSTS_IDX = 2;
private static final long COMP_THRES_SECONDS = 30;
protected void run() {
Class klass = getClass();
// 1) Vectorization correctness test
// For each method annotated with @Test in the test method, this test runner
// For each method annotated with "@Test" in test classes, this test runner
// invokes it twice - first time in the interpreter and second time compiled
// by C2. Then this runner compares the two return values. Hence we require
// each test method returning a primitive value or an array of primitive type.
// And each test method should not throw any exceptions.
Class klass = getClass();
// Add extra VM options to verify experimental auto-vectorization
WB.setBooleanVMFlag("UnlockExperimentalVMOptions", true);
WB.setBooleanVMFlag("PostLoopMultiversioning", true);
for (Method method : klass.getDeclaredMethods()) {
@@ -80,8 +70,6 @@ public class VectorizationTestRunner {
// To test vectorizability, invoke the IR test framework to check existence of
// expected C2 IR node.
TestFramework irTest = new TestFramework(klass);
// Add extra VM options to enable more auto-vectorization chances
irTest.addFlags("-XX:-OptimizeFill");
irTest.start();
}
@@ -117,9 +105,9 @@ public class VectorizationTestRunner {
Object expected = null;
Object actual = null;
// Lock compilation and inovke the method to get reference result from
// the interpreter
WB.lockCompilation();
// Temporarily disable the compiler and invoke the method to get reference
// result from the interpreter
WB.setBooleanVMFlag("UseCompiler", false);
try {
expected = method.invoke(this);
} catch (Exception e) {
@@ -127,16 +115,13 @@ public class VectorizationTestRunner {
fail("Exception is thrown in test method invocation (interpreter).");
}
assert(WB.getMethodCompilationLevel(method) == COMP_LEVEL_INTP);
WB.unlockCompilation();
WB.setBooleanVMFlag("UseCompiler", true);
// Compile the method and invoke it again
long enqueueTime = System.currentTimeMillis();
WB.enqueueMethodForCompilation(method, COMP_LEVEL_C2);
while (WB.getMethodCompilationLevel(method) != COMP_LEVEL_C2) {
if (System.currentTimeMillis() - enqueueTime > COMP_THRES_SECONDS * 1000) {
fail("Method is not compiled after " + COMP_THRES_SECONDS + "s.");
}
Thread.sleep(50 /*ms*/);
Thread.sleep(100 /*ms*/);
}
try {
actual = method.invoke(this);