feat(ptodsl): expose pto.section("cube") and pto.section("vector") interface as an explicit section hint - #1041
Conversation
21bd65b to
b52e71a
Compare
|
|
||
| if (*source == AddressSpace::ACC) | ||
| return InferredSectionKind::Cube; | ||
| if (*source == AddressSpace::VEC || *destination == AddressSpace::VEC) |
There was a problem hiding this comment.
UB -> L1 和 L1 -> UB 会归为 Vector, 是否会有问题
| outer = Module.create() | ||
| outer.operation.attributes["pto.target_arch"] = StringAttr.get(spec.target_arch) | ||
|
|
||
| if spec.kernel_kind is None: |
There was a problem hiding this comment.
已增加对simt kernel的适配
07ffcc9 to
5f34398
Compare
|
/run a3 |
|
/run a5 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A5 板测失败
日志尾部 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A3 板测失败
失败用例
|
A3 板测失败详情:PR #1041syncall_binding
comm_p2p_binding_variants
comm_p2p
|
ede4431 to
3906634
Compare
|
/run a5 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A5 板测失败
日志尾部 |
|
/run a5 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A5 板测失败
日志尾部 |
1818aa8 to
c93e90d
Compare
|
/run a5 |
|
已接收
页面会自动刷新,可以直接看当前阶段、排队情况和最近结果。 |
A5 板测失败
日志尾部 |
c93e90d to
5b7fa20
Compare
c37805f to
2b7feda
Compare
9d0d6a5 to
8fe48c3
Compare
8fe48c3 to
bb5966f
Compare
| for (func::FuncOp funcOp : childModule.getOps<func::FuncOp>()) | ||
| funcs.push_back(funcOp); | ||
| }); | ||
| moduleOp.walk([&](func::FuncOp funcOp) { funcs.push_back(funcOp); }); |
There was a problem hiding this comment.
The same fix was not applied to PTOPlanMemoryModern.cpp.
--plan-memory-impl defaults to legacy (tools/ptoas/ptoas.cpp:416), so this pass is the default path and the fix lands where it matters. But lib/PTO/Transforms/PTOPlanMemoryModern.cpp:1653-1666 still carries exactly the block that is deleted here:
moduleOp.walk([&](ModuleOp childModule) {
if (childModule == moduleOp)
return;
bool hasTileOpHelper = llvm::any_of(
childModule.getOps<func::FuncOp>(), [](func::FuncOp funcOp) {
return funcOp->hasAttr("pto.tileop.helper");
});
if (!hasTileOpHelper)
return; // <-- the new child shape is skipped here
for (func::FuncOp funcOp : childModule.getOps<func::FuncOp>())
funcs.push_back(funcOp);
});With _DEFAULT_KERNEL_KIND now None, a pto.backend child module commonly carries neither pto.kernel_kind nor any pto.tileop.helper function. Whenever the driver does not promote it to a top-level compile unit (isUserVisibleIROutputRequested() modes, or direct pto-test-opt invocation), --plan-memory-impl=modern hits the if (!hasTileOpHelper) return; early exit and the child's functions are never planned - silently, with no diagnostic. That is the same failure mode this hunk fixes for the legacy planner.
The new regression test test/lit/pto/nested_resolve_reserved_buffers.pto runs --pto-plan-memory, i.e. the legacy planner only, so the modern planner has no coverage for the nested shape either.
Is the modern planner intentionally kept on the old behaviour? If so a short comment there would help. Otherwise the same moduleOp.walk(...) change plus an extra --plan-memory-impl=modern RUN line on the new lit test would close the gap.
Summary
pto.mioperations.pto.section("cube")andpto.section("vector")as explicit section hints.Motivation
Mixed Cube/Vector kernels require each operation region to be assigned to a physical section. PTOAS can usually infer the section from the operation kind, pipeline, or buffer address space.
However, the current inference cannot determine the section of
set_flag/wait_flagoperations betweenPIPE_MTE2andPIPE_S. Both pipelines are available on the Cube and Vector cores, so the pipe pair alone does not provide enough information to identify the intended physical section.Silently choosing either section could result in incorrect placement. Therefore, when such an ambiguous region cannot be classified from its surrounding operations, PTOAS now reports an explicit error and asks the user to provide a section hint:
Explicit section hints are intended as an escape hatch for ambiguous regions. Regions that can be classified unambiguously continue to use automatic inference.
Changes
pto.mioperations.pto.section("cube")andpto.section("vector")PTODSL context manager.PIPE_MTE2↔PIPE_Ssynchronization.