llvm / llvm/llvm-project

RISCV rvv unoptimal vector_deinterleave lowering

Open
#222,938 6 comments 0 reactions 0 assignees View on GitHub
backend:RISC-V missed-optimization
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

When a fixed-length VECTOR_DEINTERLEAVE tuple exceeded LMUL=8, the lowering recursively split its operands in registers introduces
extra instructions.

It can be optimally lowered by storing each complete operand contiguously instead. then select a legal chunk type,
and then issue segmented loads at consecutive offsets, and concatenate the corresponding result chunks.

testcase: https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/RISCV/rvv/vector-deinterleave-fixed.ll#L226

can be optimized to use segmented load to save 20+ instrucitons

Contributor guide

Open the contributing guide

Research direction

Start with the testcase in llvm/test/CodeGen/RISCV/rvv/vector-deinterleave-fixed.ll around line 226, then trace the fixed-length VECTOR_DEINTERLEAVE lowering and its generated instructions. Compare the current recursive split with the proposed segmented-load approach. Done means the testcase uses fewer instructions while preserving correct lowering and passes the relevant RISC-V code-generation tests.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.