[llvm-branch-commits] [llvm] [SLP] Pass a lane as the vector cost context only if all lanes agree (PR #241758)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Nov 12 01:50:57 PST 2026
michaelselehov wrote:
On AMDGPU this phantom saving made SLP vectorize f64 reduction trees in a RAJAPerf kernel (EDGE3D). gfx942 has no packed f64 ALU, so the vector code is scalarized again, and the kernel went from 446 to 512 registers with 540 bytes per lane of spills into scratch. It ran 4x slower on MI300X and 3.5x slower on MI350X. With this patch the kernel is back to 446 registers, no scratch, and the original speed.
The check compares the vector cost, not the scalar cost, because some folds exist only for vector types (the AArch64 bit select). The alternate nodes split lanes with isAlternateInstruction, so compares with the same opcode and different predicates are checked separately. The X86 remark test shows this case: the decision does not change, but the cost does.
https://github.com/llvm/llvm-project/pull/241758
More information about the llvm-branch-commits
mailing list