fix: align MAT fill and expand sync pipes#930
Conversation
Codex Review该评论由 review 机器人自动更新。
SummaryReview failed at stage Findings未生成结构化 findings,因为 review 过程提前失败。 Log Tail |
There was a problem hiding this comment.
Code Review
This pull request updates the pipe selection logic for TExpandsOp and TFillPadOp in PTOOps.td. Specifically, TExpandsOp now determines its pipe based on the destination address space (returning PIPE_MTE2 for MAT), and TFillPadOp has been updated to return PIPE_MTE2 instead of PIPE_MTE1 when both source and destination are in the MAT address space. Corresponding test cases have been added and updated to verify these changes. The review feedback suggests simplifying the getASFromType helper lambda in TExpandsOp to reduce boilerplate and improve readability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| auto getASFromType = [](Type ty) | ||
| -> std::optional<::mlir::pto::AddressSpace> { | ||
| if (auto tb = ::mlir::dyn_cast<::mlir::pto::TileBufType>(ty)) { | ||
| if (auto as = ::mlir::dyn_cast_or_null<::mlir::pto::AddressSpaceAttr>( | ||
| tb.getMemorySpace())) | ||
| return as.getAddressSpace(); | ||
| return std::nullopt; | ||
| } | ||
| if (auto mr = ::mlir::dyn_cast<::mlir::MemRefType>(ty)) { | ||
| if (auto ms = mr.getMemorySpace()) { | ||
| if (auto as = ::mlir::dyn_cast<::mlir::pto::AddressSpaceAttr>(ms)) | ||
| return as.getAddressSpace(); | ||
| } | ||
| return std::nullopt; | ||
| } | ||
| return std::nullopt; | ||
| }; |
There was a problem hiding this comment.
The helper lambda getASFromType can be simplified to reduce boilerplate and improve readability by extracting the memory space attribute first, and then performing a single dyn_cast_or_null check.
auto getASFromType = [](::mlir::Type ty) -> std::optional<::mlir::pto::AddressSpace> {
::mlir::Attribute ms;
if (auto tb = ::mlir::dyn_cast<::mlir::pto::TileBufType>(ty))
ms = tb.getMemorySpace();
else if (auto mr = ::mlir::dyn_cast<::mlir::MemRefType>(ty))
ms = mr.getMemorySpace();
if (auto as = ::mlir::dyn_cast_or_null<::mlir::pto::AddressSpaceAttr>(ms))
return as.getAddressSpace();
return std::nullopt;
};
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
/run a3 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A3 板测完成(有跳过)
|
Summary
Align PTOAS automatic sync pipe selection with the current pto-isa event contract for MAT tile operations:
TFILLPAD(MAT)asPIPE_MTE2instead ofPIPE_MTE1TEXPANDS(MAT)asPIPE_MTE2while preservingPIPE_Vfor vector destinationsRoot cause
The current pto-isa mapping defines:
TFILLPAD_MAT -> PIPE_MTE2TEXPANDS_MAT -> PIPE_MTE2TEXPANDS -> PIPE_VPTOAS classified MAT TFILLPAD as MTE1 and all TEXPANDS as V. For a MAT producer followed by a MAT-to-RIGHT TMOV, sync insertion therefore placed an event before the producer or emitted an event for the wrong source pipe, leaving the actual MTE2 producer unordered with the MTE1 consumer.
Change
TExpandsOp::getPipe()to inspect the destination address space in both tile and lowered memref form.TFillPadOp::getPipe()result to MTE2.Verification
ptoasbuild completed successfully.check-pto: 847/847 passed.Reviewed against pto-isa
ecb6c303f797749f811a494742c3c08156aacabb.