RFR: 8373026: C2 SuperWord and Vector API: vector algorithms test and benchmark [v4]

Vladimir Ivanov vlivanov at openjdk.org
Fri Jan 16 21:36:48 UTC 2026


On Fri, 16 Jan 2026 07:50:26 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/compiler/vectorization/TestVectorAlgorithms.java line 97:
>> 
>>> 95:         framework.addFlags("--add-modules=jdk.incubator.vector", "-XX:CompileCommand=inline,*VectorAlgorithmsImpl::*");
>>> 96:         switch (args[0]) {
>>> 97:             case "vanilla"        -> { /* no extra flags */ }
>> 
>> It would be more flexible to let arbitrary VM flags to be appended.
>
> What exactly are you suggesting here? Are you suggesting that instead of doing:
> 
> ` * @run driver ${test.main.class} noSuperWord`
> we could do
> ` * @run driver ${test.main.class} -XX:-OptimizeFill`
> 
> And then just `framework.addFlags(args)`?

Yes. Or introduce a property.

>> test/hotspot/jtreg/compiler/vectorization/TestVectorAlgorithms.java line 218:
>> 
>>> 216: 
>>> 217:             // X4 oop setup.
>>> 218:             oopsX4 = new int[size];
>> 
>> Any particular reason to keep input data initialization duplicated between test and benchmark modes?
>
> Yes. Because they are not exactly the same. One is designed to test the implementation, the other to deliver reasonably stable and meaningful benchmarks.
> 
> Example of some differences:
> - In the "test" environment, I have access to test libraries like `Generators.java`, which are better at generating edge-cases than regular `Random`.
> - In the benchmark, the size is a fixed parameter `SEED`. In the test, it is a randomly chosen value, so we can test better for alignment/drain/post loops.
> - `eI` can be chosen randomly in each iteration of the test. But for the benchmark it is better if we have an array of values to chose from, so that we can pick different values for each benchmark invocation.
> 
> But there is still a lot of overlap. I could try to split it into a "shared" and "local" part, and stuff the "shared" part into `VectorAlgorithmsImpl.Data`. @iwanowww Do you think that is worth it?

Ok, up to you.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28639#discussion_r2700028889
PR Review Comment: https://git.openjdk.org/jdk/pull/28639#discussion_r2700032354


More information about the hotspot-compiler-dev mailing list