RFR: 8307084: C2: Vectorized drain loop is not executed for some small trip counts [v3]
Fei Gao
fgao at openjdk.org
Wed Dec 10 13:28:39 UTC 2025
On Mon, 8 Dec 2025 15:31:24 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
> Sorry, I dropped the ball on this one. A lot going on with JDK26 and other larger PRs.
>
No worries. Thanks for taking the time to look at it!
> Ah I see. You are indeed doing some special warmup here. That should be better documented. I wonder also if you want to make this a parameter, so we can see the performance with and without it?
>
Sure. I’ll update it with clearer comments and add a parameter in the next commit.
> At some point I need to check out your patch and see what effect it has on the benchmarks I'm presenting here: #27315
>
Thanks for benchmarking it!
> Do you think it would really not be measurable for small sizes? If not, we would have to find other methods to make a difference for small iteration counts.
I don’t think small-iteration loops are unmeasurable in terms of performance—it really depends on what scenarios we want to benchmark. If the goal is to measure how C2 performs on small fixed-iteration loops, then benchmarking microcases with a fixed small trip count makes sense. But if we want to measure how auto-vectorized C2 code behaves when executing small-iteration loops, then a special warm-up phase is needed to ensure vectorization actually occurs.
I’m not sure I fully understood your question. Could you clarify which scenario you would like to benchmark for small iteration loops?
>
> > It may decide not to auto-vectorize, or even remove the loop entirely and keep only some scalar nodes.
>
> It could be worth creating some IR tests to see what exactly happens here.
Yes, that makes sense. I expect the IR tests may vary across machines with different vector lengths. We could handle this in a separate PR, since it's to observe the behavior of the existing C2 implementation.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22629#discussion_r2606649903
More information about the hotspot-compiler-dev
mailing list