[llvm] Use 256 bit register when AVX2 or higher is available. (PR #91721)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 21 22:12:40 PST 2026
shamithoke wrote:
@RKSimon, Sorry It took me a while to respond.
I’ve revisited this PR after adding a llvm-test-suite Microbenchmark.
To address the concern about 'side effects' vs. GFNI, I’ve expanded the scope of this PR from just using YMM for scalars to enforcing YMM for the leftover loop elements vectorized by AVX. This ensures the entire path remains in the same execution state.
I ran these through llvm-mca and a set of local tests. I do not have access to a dedicated machine for benchmarking, so I am tested on a VPS - AMZ Zen 4 (not a standard dedicated benchmark machine), the trends are consistent:
-- Test 1: The PR shows a ~2.3% improvement (1.26 us vs 1.29 us). This gain is likely attributed to avoiding the costly SSE <-> AVX transition penalties that occur when 128-bit GFNI is mixed with surrounding AVX library code.
-- Scalar Consistency: The PR version actually improved stability, reducing the Coefficient of Variation (CV) from 2.74% to 2.47%.. The latency was marginally impacted in the PR version though.
-- Pipeline Data: llvm-mca confirms a reduction in average scheduler latency from 13.6 to 13.1 cycles when moving to the enforced YMM path.
I haven't updated the code in this PR yet as it’s quite old and I wanted to align on expectations first. Given these results, would you like me to prepare data on a more complex design like an FFT to see how this translates to real-world math workloads? Or is a simple benchmark good enough?
If that data looks good to you, I’ll rebase this or open a fresh PR with the expanded YMM scope.
https://github.com/llvm/llvm-project/pull/91721
More information about the llvm-commits
mailing list