[AscendNPU-IR][A5] Added A5 support for FlipOp#911
[AscendNPU-IR][A5] Added A5 support for FlipOp#911Ismayil06 wants to merge 1 commit intotile-ai:npuir-devfrom
Conversation
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
There was a problem hiding this comment.
Code Review
This pull request updates the VflipCodegen implementation in codegen_npuir_dev.cc to utilize mlir::hfusion::FlipOp and ReshapeCastAndInsertSlice, and introduces a new test file to verify the functionality. A redundant double assignment was found in the VflipCodegen function that should be simplified.
| builder.create<mlir::hivm::VFlipOp>(builder.getUnknownLoc(), TypeRange{}, src, | ||
| dst, npuirop.axis); | ||
| Value src = GenExtractSliceFromRegion(npuirop.src, npuirop.src_range); | ||
| Value dst = dst = GetVarValue(npuirop.dst); |
There was a problem hiding this comment.
| a = T.alloc_shared((M, N), dtype) | ||
| b = T.alloc_shared((M, N), dtype) | ||
| T.copy(A, a) | ||
| T.npuir_flip(a, b, axis) |
There was a problem hiding this comment.
This test case do not trigger GenExtractSliceFromRegion, if don't support, please use GetVarValue
There was a problem hiding this comment.
also, Please use flip
69acf78 to
e696969
Compare
| auto loc = builder.getUnknownLoc(); | ||
| auto srcTy = src.getType().cast<RankedTensorType>(); | ||
|
|
||
| auto flipOp = builder.create<mlir::hfusion::FlipOp>(loc, srcTy, src, static_cast<uint64_t>(npuirop.axis)); |
There was a problem hiding this comment.
If a negative axis is passed upstream (e.g., axis=-1 in Python), the implicit int64_t → u_int64_t conversion would produce a huge unsigned value. Add negative axis legalization in the NpuirFlip constructor (converting negative to positive), or add an ICHECK(npuirop.axis >= 0) assertion in VflipCodegen .
| B_VEC = T.alloc_shared((M, N), dtype) | ||
|
|
||
| T.copy(A, A_VEC) | ||
| T.npuir_flip(A_VEC, B_VEC, axis) |
[AscendNPU-IR][A5] Added A5 support for FlipOp
- Changed hivm::VFlipOp to hfusion::FlipOp
- Added pytest for FlipOp