[PTODSL] Redesign TileOp single-core helper ABI#937
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 implements the PTODSL TileOp single-core pure UB redesign, introducing the @pto.tileop decorator and the PTOMaterializeTileOpSections compiler pass to wrap helper bodies in single compute sections with explicit SSA boundaries. It also updates memory planning, pointer normalization, and module splitting to support these explicit boundaries. The review feedback highlights critical issues in the validation and analysis passes: first, the Python validation for @pto.tileop return types can be bypassed when no return type is annotated due to inspect.Parameter.empty handling; second, the transitive dependency analysis in VPTOSplitCVModule fails to recurse into same-kind sections, potentially missing opposite-kind dependencies; and third, the cross-kind scalar dependency check should walk nested operations to catch implicit captures that are not part of the explicit section operands.
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.
1ec0482 to
79b4284
Compare
| not require users or the frontend to manually partition every operation into a | ||
| final section. | ||
| rules. PTODSL exposes named `@pto.tileop` / `@pto.simt` helpers and inline | ||
| `with pto.simd():` / `with pto.cube():` scopes, but does not require users or |
There was a problem hiding this comment.
with pto.simd()和with pto.cube()本来就是@pto.simd/@pto.cube的一种特殊形式,现在@pto.simd/@pto.cube删掉了,这俩也可以删掉了。
可以提供一个with pto.tileop(),然后对捕获的边界变量做和@pto.tileop函数一样的约束
There was a problem hiding this comment.
漏了, 已补充。 支持 with pto.tileop()。with pto.simd()、with pto.cube() 与对应 decorator 使用同一 legacy 接口诊断
eaa0715 to
49e4214
Compare
| kL0BTile: pto.Tile, | ||
| qkAccTile: pto.Tile, | ||
| qkVecTileSub: pto.Tile, | ||
| rows: pto.index, |
There was a problem hiding this comment.
pto.index不是DSL手册里的数据类型,这里写pto.i32之类的吧
There was a problem hiding this comment.
该示例已按本轮决定删除,因此这处 pto.index 签名随文件一并移除,无需单独引入 pto.i32 ABI 改动。
| pto.wait_flag("MTE2", "V", event_id=0) | ||
|
|
||
| with pto.simd(): | ||
| with pto.tileop(): |
There was a problem hiding this comment.
对于explicit的kernel,其实没必要加pto.tileop,因为我们的初衷就是给auto mode用的
There was a problem hiding this comment.
已将该 explicit 示例改为直接保留 Vector compute,不再展示 with pto.tileop。设计上仍保留 TileOp 跨 auto 和 explicit mode 的支持;inline TileOp 是可选的匿名 helper boundary,相关 explicit 正例已由测试覆盖。
| cols = kMatTile.valid_shape[0] | ||
|
|
||
| pto.mte_l1_l0a(qMatTile.as_ptr(), qL0ATile.as_ptr(), rows, head) | ||
| pto.mte_l1_l0b(kMatTile.as_ptr(), kL0BTile.as_ptr(), head, cols, transpose=True) |
There was a problem hiding this comment.
然后这个example其实和我们现在的设计差得比较远了,只改这里也没办法让完整的kernel逻辑自洽,我感觉没有继续当做example的意义了,可以删掉
There was a problem hiding this comment.
已删除 fa_dn_ptodsl.py。该样例只完成局部迁移且依赖缺失模块,不再作为用户示例保留。
| pto.wait_flag("MTE2", "V", event_id=0) | ||
|
|
||
| with pto.simd(): | ||
| with pto.tileop(): |
There was a problem hiding this comment.
这里也是类似的,explicit模式不用加pto.tileop
There was a problem hiding this comment.
已将该 explicit 示例改为直接保留 Vector compute,不再展示 with pto.tileop;TileOp 跨 mode 支持仍由明确的 API 合同和测试覆盖。
| name.starts_with("pto.mgather") || name.starts_with("pto.mscatter"); | ||
| } | ||
|
|
||
| static bool isVectorMicroOperation(StringRef name) { |
There was a problem hiding this comment.
用op name判断Section感觉不太优雅。能否用OP所属的PIPE来判断呢?参考一下自动infer section的pass,或者能不能和自动infer section的pass合并?
There was a problem hiding this comment.
通过ods 中增加tarit的方式识别op类型
2cdb2ce to
363e9e7
Compare
363e9e7 to
c419a6e
Compare
| @@ -1,4 +1,4 @@ | |||
| // RUN: ! ptoas --pto-arch=a5 --pto-backend=vpto --emit-vpto %s -o - 2>&1 | FileCheck %s | |||
There was a problem hiding this comment.
测例名字也改一下比较好,现在这是一个正例了
| // See LICENSE in the root of the software repository for the full text of the License. | ||
|
|
||
| // RUN: ptoas --pto-arch=a5 --pto-backend=vpto --emit-vpto %s -o - | FileCheck %s | ||
| // RUN: ptoas --pto-arch=a5 --emit-pto-ir %s -o - | FileCheck %s |
There was a problem hiding this comment.
这个lit用例改动没看懂,原来应该是想看护split cv module这个pass的,改了之后看护失效了
| @@ -1,4 +1,4 @@ | |||
| // RUN: ptoas --pto-arch=a5 --pto-backend=vpto --emit-vpto %s -o - | FileCheck %s | |||
| // RUN: ptoas --pto-arch=a5 --emit-pto-ir %s -o - | FileCheck %s | |||
| static bool isPTODSLSubkernelHelperFunc(func::FuncOp fn) { | ||
| return fn->hasAttr("pto.ptodsl.subkernel_helper"); | ||
| return fn->hasAttr("pto.ptodsl.subkernel_helper") || | ||
| fn->hasAttr("pto.tileop.helper"); |
There was a problem hiding this comment.
pto.ptodsl.subkernel_helper是旧方案,现在切到新方案只需要保留pto.tileop.helper就行了吧,函数名也可以改一下
Replace legacy cube/simd subkernel decorators with typed TileOp and SIMT helpers while keeping TileOp helpers void. Materialize compute sections, preserve dynamic Tile metadata, summarize memory effects for synchronization, and update lowering, examples, docs, and regression coverage.
Use reusable ODS instruction-class interfaces to infer sections and classify TileOp helper contract violations without opcode-name matching. Keep AST-rewrite example baselines aligned with explicit-mode inline compute.
c419a6e to
a3fbc09
Compare
Summary
a1371bc7, including the new wheel-first TileLib framework.@pto.tileoparound a Tile plus PTO scalar parameter ABI. TileOp helpers remain void; results are written through mutable Tile parameters.pto.section.vector/cubeABI unchanged: no operands, no results, nopto.section.yield, and the original Python constructors remain valid.@pto.cubeand@pto.simddecorators with an actionable migration diagnostic. Inlinewith pto.cube():andwith pto.simd():scopes remain supported.MemoryEffectOpInterfacebuffer operands used by TileOp micro-instructions such asvldsandvsts.Compatibility and existing coverage
@pto.tileop. MTE, pipe synchronization, allocation, and orchestration remain in@pto.jit.test/sampleshas no net diff from main for this section ABI change.test/tilelib-st/a5/tmatmul/case.pyonly removes an unused named legacy@pto.cubehelper; the tmatmul simulator case still passes.Validation
All validation was rerun after the PlanMemory fix, the final void-return decision, the rebase onto
a1371bc7, and the PTOViewToMemref attribute-lifetime fix.test/dsl-sttest/tilelib-st/a5The 144 validation used the installed PTOAS wheel and
/opt/llvm/lib. It did not addllvm-project-vpto21/build-assert/libtoLD_LIBRARY_PATH.