Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a separate option to allow running Panama Vectorization for all tests with suitable C2 defaults #13351

Merged
merged 6 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle/testing/defaults-tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ allprojects {
includeInReproLine: false
],
[propName: 'tests.jvmargs',
value: { -> propertyOrEnvOrDefault("tests.jvmargs", "TEST_JVM_ARGS", isCIBuild ? "" : "-XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1") },
value: { -> envOrDefault("TEST_JVM_ARGS", (isCIBuild || testsDefaultVectorizationRequested()) ? "" : "-XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1") },
description: "Arguments passed to each forked JVM."],
// Other settings.
[propName: 'tests.neverUpToDate', value: true,
Expand All @@ -66,6 +66,8 @@ allprojects {
}
return propertyOrDefault(option.propName, option.value)
}

testsDefaultVectorizationRequested = { -> Boolean.parseBoolean(resolvedTestOption('tests.defaultvectorization') as String) }

testsCwd = file("${buildDir}/tmp/tests-cwd")
testsTmpDir = file(resolvedTestOption("tests.workDir"))
Expand Down Expand Up @@ -116,8 +118,6 @@ allprojects {

ignoreFailures = resolvedTestOption("tests.haltonfailure").toBoolean() == false

jvmArgs Commandline.translateCommandline(resolvedTestOption("tests.jvmargs"))

// Up to JDK-15 we have to enforce --illegal-access=deny, because we want no code to access
// JDK internals; JDK-16 and later will default to deny, see https://openjdk.java.net/jeps/396:
if (rootProject.runtimeJavaVersion < JavaVersion.VERSION_16) {
Expand Down
15 changes: 10 additions & 5 deletions gradle/testing/randomization.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ allprojects {
allprojects {
plugins.withType(JavaPlugin) {
ext {
String randomVectorSize = RandomPicks.randomFrom(new Random(projectSeedLong), ["default", "128", "256", "512"])
testOptions += [
// seed, repetition and amplification.
[propName: 'tests.seed', value: { -> rootSeed }, description: "Sets the master randomization seed."],
Expand Down Expand Up @@ -106,11 +107,13 @@ allprojects {
[propName: 'tests.bwcdir', value: null, description: "Data for backward-compatibility indexes."],
// vectorization related
[propName: 'tests.vectorsize',
value: { ->
RandomPicks.randomFrom(new Random(projectSeedLong), ["128", "256", "512"])
},
description: "Sets preferred vector size in bits."],
[propName: 'tests.forceintegervectors', value: "true", description: "Forces use of integer vectors even when slow."],
value: { -> testsDefaultVectorizationRequested() ? 'default' : randomVectorSize },
description: "Sets preferred vector size in bits."],
[propName: 'tests.forceintegervectors',
value: { -> testsDefaultVectorizationRequested() ? false : (randomVectorSize != 'default') },
description: "Forces use of integer vectors even when slow."],
[propName: 'tests.defaultvectorization', value: false,
description: "Uses defaults for running tests with correct JVM settings to test Panama vectorization (tests.jvmargs, tests.vectorsize, tests.forceintegervectors)."],
]
}
}
Expand Down Expand Up @@ -172,6 +175,8 @@ allprojects {
// and not the test JVM itself.
systemProperties testOptionsResolved

jvmArgs Commandline.translateCommandline(testOptionsResolved['tests.jvmargs'])

if (Boolean.parseBoolean(testOptionsResolved['tests.asserts'])) {
jvmArgs("-ea", "-esa")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public abstract class VectorizationProvider {
try {
vs =
Stream.ofNullable(System.getProperty("tests.vectorsize"))
.filter(Predicate.not(String::isEmpty))
.filter(Predicate.not(Set.of("", "default")::contains))
ChrisHegarty marked this conversation as resolved.
Show resolved Hide resolved
.mapToInt(Integer::parseInt)
.findAny();
} catch (
Expand Down