Fix A5 GEMV verifier for aligned ACC rows#651
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors tile layout verification for the a5 architecture by introducing the verifyMadTileLayoutsA5 function and updating verifyMatTileOperandsA5 and verifyGemvTileOperandsA5 to use it. It also adds a new LIT test for tgemv operations. Feedback suggests improving the robustness of the new verification function by checking each operand's type independently rather than skipping all layout checks if a single operand is not a TileBufType.
| static LogicalResult verifyMadTileLayoutsA5(Operation *op, Type lhsTy, | ||
| Type rhsTy, Type dstTy) { |
There was a problem hiding this comment.
The current implementation of verifyMadTileLayoutsA5 (refactored from verifyMatTileOperandsA5) uses an "all-or-nothing" check for TileBufType operands. If any of the operands is not a TileBufType (e.g., a MemRefType during intermediate lowering stages), all layout checks are skipped for the remaining operands. It would be more robust to check each operand independently if it is a TileBufType.
Codex Review该评论由 review 机器人自动更新。
SummaryA5 GEMV verifier regressed in this PR: the new helper call fixes aligned ACC rows, but it also drops prior range and logical-shape validation for all A5 GEMV variants. Findings
This refactor fixes aligned ACC rows by bypassing |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b186ac481
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (failed(verifyGemvTileOperandsA2A3(op, lhsTy, rhsTy, dstTy))) | ||
| return failure(); | ||
| return verifyMatTileOperandsA5(op, lhsTy, rhsTy, dstTy); | ||
| return verifyMadTileLayoutsA5(op, lhsTy, rhsTy, dstTy); |
There was a problem hiding this comment.
Reinstate GEMV K/N bound checks on A5
Changing A5 GEMV verification to call only verifyMadTileLayoutsA5 drops the [1, 4095] valid-size guard that previously came from verifyMatTileOperandsA2A3 via verifyMatTileOperandsA5. As a result, pto.tgemv* now accepts static valid_shape values such as K=5000 or N=5000 on A5, even though matmul-family verification still treats those sizes as out of range; this can allow invalid TGEMV dimensions through verification and fail later in lowering/codegen.
Useful? React with 👍 / 👎.
Summary
pto.tgemv,pto.tgemv.acc, andpto.tgemv.biaswith aligned ACC rows butvalid_shape[0] == 1Validation
git diff --checkcmake -G Ninja -S . -B build-local ...ptoasbuild is currently blocked by pre-existing macOS-Wcovered-switch-defaulterrors inlib/PTO/IR/PTOSyncUtils.cppandlib/PTO/IR/PTOTypeDefs.cpp