Skip to content

Conversation

@Sameeranjoshi
Copy link

@Sameeranjoshi Sameeranjoshi commented Jul 16, 2025

G_FPEXT crashed for vector types when converting <32xbfloat> -> <32xfloat> as vectors were not handled in legalizer. This patch adds support for vectors with a custom legalizer rule using following pattern

   VDst = G_FPEXT VSrc

converts to something like below

   ZeroVec = G_AIE_BROADCAST_VECTOR VSrc
   VShuffleLow = G_AIE_SHUFFLE_VECTOR ZeroVec, VSrc, 2
   VShuffleHigh = G_AIE_SHUFFLE_VECTOR ZeroVec, VSrc, 3
   VShuffleLow = G_BITCAST VShuffleLow
   VShuffleHigh = G_BITCAST VShuffleHigh
   VDst = G_CONCAT_VECTORS VShuffleLow, VShuffleHigh

Sameeranjoshi added a commit to Sameeranjoshi/iree-amd-aie that referenced this pull request Jul 21, 2025
Patch adds tests to make sure all the tests with `vector.multi_reduction`
generate successfully pass Peano legalizer and generate efficient vectorized code.
This patch checks only the IREE side to keep the dependency minimun on Peano.
(Depends on Peano:
1. Xilinx/llvm-aie#548
2. Xilinx/llvm-aie#557
)

1. `reassociateFpReductions=true` is must else code is scalarized. This flag
could be added into the IREE vectorization pipeline to trigger automatically.
2. bf16/i32/f32 all types with different sizes work now.
Sameeranjoshi added a commit to Sameeranjoshi/iree-amd-aie that referenced this pull request Jul 21, 2025
Patch adds tests to make sure all the tests with `vector.multi_reduction`
generate successfully pass Peano legalizer and generate efficient vectorized code.
This patch checks only the IREE side to keep the dependency minimun on Peano.
(Depends on Peano:
1. Xilinx/llvm-aie#548
2. Xilinx/llvm-aie#557
)

1. `reassociateFpReductions=true` is must else code is scalarized. This flag
could be added into the IREE vectorization pipeline to trigger automatically.
2. bf16/i32/f32 all types with different sizes work now.
Sameeranjoshi added a commit to Sameeranjoshi/llvm-aie that referenced this pull request Jul 22, 2025
…d code.

This patch is dependent on Xilinx#548 and Xilinx#557. Previously bf16 and f32 failed to
generate fully vectorized code and used to scalarize, this test makes sures
different types and vector sizes work and are fully vectorized.

This is a supplementary patch for verifying below pipeline:
Part 1: `vector.multi_reduction` to `vector.reduction` to `llvm.vector.reduce.fadd.*`
nod-ai/iree-amd-aie#1336
Part 2: Further lowers to AIE2P instructions.(This patch)
@Sameeranjoshi
Copy link
Author

Squashed into #604

mgehre-amd pushed a commit that referenced this pull request Aug 21, 2025
[AutoBump] Merge with fixes of 977d744 (Jan 20) (10) (May need downstream changes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant