RFR: 8342958: Use jvmArgs consistently in microbenchmarks

Emanuel Peter epeter at openjdk.org
Thu Oct 31 07:33:36 UTC 2024


On Thu, 24 Oct 2024 13:52:57 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> Many OpenJDK micros use `@Fork(jvmArgs/-Append/-Prepend)` to add JVM reasonable or necessary flags, but when deploying and running micros we often want to add or replace flags to tune to the machine, test different GCs, etc. The inconsistent use of the different `jvmArgs` options make it error prone, and we've had a few recent cases where we've not been testing with the expected set of flags. 
> 
> This PR suggests using `jvmArgs` consistently. I think this aligns with the intuition that when you use `jvmArgsAppend/-Prepend` intent is to add to a set of existing flags, while if you supply `jvmArgs` intent is "run with these and nothing else". Perhaps there are other opinions/preferences, and I don't feel strongly about which to consolidate to as long as we do so consistently. One argument could be made to consolidate on `jvmArgsAppend` since that one is (likely accidentally) the current most popular (143 compared to 59 `jvmArgsPrepend` and 18 `jvmArgs`).

Hi Claes,
I'm having some strange results with your JMH PR:
https://github.com/openjdk/jdk/pull/21683
And my benchmark:
https://github.com/openjdk/jdk/blame/master/test/micro/org/openjdk/bench/vm/compiler/VectorLoadToStoreForwarding.java
Running it like this:
`make test TEST="micro:vm.compiler.VectorLoadToStoreForwarding.*benchmark_03" CONF=linux-x64`
And I'm getting this result:

Benchmark                                                                        (SIZE)  (seed)  Mode  Cnt     Score    Error  Units
VectorLoadToStoreForwarding.VectorLoadToStoreForwardingNoSuperWord.benchmark_03    2048       0  avgt   10  4563.110 ± 64.988  ns/op
VectorLoadToStoreForwarding.VectorLoadToStoreForwardingSuperWord.benchmark_03      2048       0  avgt   10  4549.337 ± 32.239  ns/op

But when I revert your change, back to `jvmArgsPrepend` :

Benchmark                                                                        (SIZE)  (seed)  Mode  Cnt     Score    Error  Units
VectorLoadToStoreForwarding.VectorLoadToStoreForwardingNoSuperWord.benchmark_03    2048       0  avgt   10  1040.538 ± 14.660  ns/op
VectorLoadToStoreForwarding.VectorLoadToStoreForwardingSuperWord.benchmark_03      2048       0  avgt   10  4533.227 ±  5.161  ns/op

It seems that with your PR, the flags don't have the intended effect any more!


With your change, I see this:
`# VM options: -Djava.library.path=/oracle-work/jdk-fork6/build/linux-x64/images/test/micro/native`
And reverting back, I see this:
`# VM options: -XX:-UseSuperWord -Djava.library.path=/oracle-work/jdk-fork6/build/linux-x64/images/test/micro/native`

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

PR Comment: https://git.openjdk.org/jdk/pull/21683#issuecomment-2449207896


More information about the security-dev mailing list