Enable interleaved vectorization for RVV.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Em, I have modified the test case according to the comments "checking the generated IR" and "debug info"(DI removed). Any other comments?
llvm/test/Transforms/LoopVectorize/RISCV/riscv-interleaved.ll | ||
---|---|---|
7 | Is this just checking the induction variable increment? I'd really like to see what vector instructions it generates. |
llvm/test/Transforms/LoopVectorize/RISCV/riscv-interleaved.ll | ||
---|---|---|
7 | For this test case, vf and uf will be 4 and 2 respectively. So the vector instructions will repeat once in one trip, and there will be an instruction like %{{.*}} = add <4 x i32> %{{.*}}, <i32 4, i32 4, i32 4, i32 4>. |
I just noticed that this enabled interleaving in the loop vectorizer even when the V extension isn't enabled. So we now generate interleaved scalar code in some cases. Was that intentional?
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | ||
---|---|---|
173 | I think these are two different features. enableInterleavedAccessVectorization is for memory accesses that are interlaved. getMaxInterleaveFactor controls loop unrolling in the vectorizer. Which feature were you trying to enable? |
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | ||
---|---|---|
173 | I think enableInterleavedAccessVectorization reads extra data and uses shuffles to extract the elements that are needed. |
llvm/test/Transforms/LoopVectorize/RISCV/riscv-interleaved.ll | ||
---|---|---|
4 | Why is this not using update_test_checks.py? | |
12–51 | This IR is very messy, Clang-output IR does not always make for clean test cases. We don't need Function Attrs comments, we don't need press comments, many of the attributes are unnecessary, and the ones that are are best done inline. IR tests should be minimal, ideally from-scratch, but whittling Clang-produced IR down to something that could feasibly have been hand-written (or generated by a simple tool, like RVV and RVA tests) is fine. |
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | ||
---|---|---|
173 | Yes, bool enableInterleavedAccessVectorization() should not be added here. I'll restore the code and submit a new patch. |
llvm/test/Transforms/LoopVectorize/RISCV/riscv-interleaved.ll | ||
---|---|---|
4 | Yeah, using update_test_checks.py is better. But as said update_test_checks.py itself, update_test_checks.py is not designed to be authoritative about what constitutes a good test :) | |
12–51 | Thanks for the review. I'll update the test case to look canonical. |
llvm/test/Transforms/LoopVectorize/RISCV/riscv-interleaved.ll | ||
---|---|---|
4 | Thanks for the comment. I'll try to update the test case using update_test_checks.py. |
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h | ||
---|---|---|
175 | Do you need to report an error if the user passes the command "-force-vector-interleave=value" that value > 2 |
I think these are two different features.
enableInterleavedAccessVectorization is for memory accesses that are interlaved.
getMaxInterleaveFactor controls loop unrolling in the vectorizer.
Which feature were you trying to enable?