nod-ai / iree-amd-aie

IREE plugin repository for the AMD AIE accelerator
Apache License 2.0
69 stars 30 forks source link

Pass to align transfer_reads #867

Closed newling closed 2 weeks ago

newling commented 3 weeks ago

This PR adds the necessary pass to align transfer_read. It is based on mlir-aie's aievec, see:

https://github.com/Xilinx/mlir-aie/blob/d3da586305ebc22e5ecdf1d3e682b44853436e91/lib/Dialect/AIEVec/Transforms/VectorToVectorConversions.cpp#L123

Some changes were needed for our use case, however. The main one is that the lowering in this PR skips the vector.extract_strided_slice operation, because we have an offset which is not constant. i.e. the offsets in https://mlir.llvm.org/docs/Dialects/Vector/#vectorextract_strided_slice-vectorextractstridedsliceop cannot be integers for us, because they are determined from loop induction variables. The pass implemented here goes straight to aievec extract and shift operations, where mlir Values are used for offsets.

Also included in this PR: an aievec.shift folder. I can make this a separate PR if preferred.

This PR enables vectorization for convolution and resolves https://github.com/nod-ai/iree-amd-aie/issues/820

jtuyls commented 3 weeks ago

Could you rename your PRs to be more descriptive of what they actually add? I was looking at the commit history earlier and Towards vectorized convolution (second PR) isn't a great commit message to understand what was added.

jtuyls commented 3 weeks ago

This PR enables vectorization for convolution and resolves #820

Are you planning to add an e2e testcase?

newling commented 2 weeks ago

Are you planning to add an e2e testcase?

The e2e numerical tests are now vectorized because of the change here in Passes.cpp