RFR: 8325482: Test that distinct seeds produce distinct traces for compiler stress flags
Christian Hagedorn
chagedorn at openjdk.org
Thu Jul 31 07:35:57 UTC 2025
On Wed, 30 Jul 2025 13:38:37 GMT, Saranya Natarajan <snatarajan at openjdk.org> wrote:
> The existing test (`compiler/debug/TestStress.java`) verifies that compiler stress options produce consistent traces when using the same seed. However, there is currently no test to ensure that different seeds result in different traces.
>
> ### Solution
> Added a test case to assess the distinctness of traces generated from different seeds. This fix addresses the fragility concern highlighted in [JDK-8325482](https://bugs.openjdk.org/browse/JDK-8325482) by verifying that traces produced using N (in this case 10) distinct seeds are all not identical.
>
> ### Changes to `compiler/debug/TestStress.java`
> While investigating this issue, I observed that in `compiler/debug/TestStress.java`, the stress options for macro expansion and macro elimination were not being triggered because there were fewer than 2 macro nodes. Note that the `shuffle_macro_nodes()` in` compile.cpp` is only meaningful when there are more than two macro nodes. The generated traces for macro expansion and macro elimination in `TestStress.java` were empty. I have proposed changes to address this problem.
Thanks for adding such a test. A few comments, otherwise, it looks good!
test/hotspot/jtreg/compiler/debug/TestStressDistinctSeed.java line 36:
> 34: * @key stress randomness
> 35: * @requires vm.debug == true & vm.compiler2.enabled
> 36: * @requires vm.flagless
can be merged:
Suggestion:
* @requires vm.debug == true & vm.compiler2.enabled & vm.flagless
test/hotspot/jtreg/compiler/debug/TestStressDistinctSeed.java line 37:
> 35: * @requires vm.debug == true & vm.compiler2.enabled
> 36: * @requires vm.flagless
> 37: * @summary Tests that stress compilations with the N different seed yield different
Suggestion:
* @summary Tests that stress compilations with the N different seeds yield different
test/hotspot/jtreg/compiler/debug/TestStressDistinctSeed.java line 102:
> 100: ccpTraceSet.add(ccpTrace(s));
> 101: macroExpansionTraceSet.add(macroExpansionTrace(s));
> 102: macroEliminationTraceSet.add(macroEliminationTrace(s));
A suggestion, do you also want to check here that two runs with the same seed produce the same result to show that different seeds really produce different results due to the seed and not just some indeterminism with the test itself? How long does your test need now and afterwards with a fastdebug build? Maybe we can also lower the number of seeds if it takes too long or only do the equality-test for a single seed.
-------------
PR Review: https://git.openjdk.org/jdk/pull/26554#pullrequestreview-3074273830
PR Review Comment: https://git.openjdk.org/jdk/pull/26554#discussion_r2244573969
PR Review Comment: https://git.openjdk.org/jdk/pull/26554#discussion_r2244574237
PR Review Comment: https://git.openjdk.org/jdk/pull/26554#discussion_r2244588666
More information about the hotspot-compiler-dev
mailing list