feat(ptodsl): Add tile debug print support - #994
Open
Crystal-wzy wants to merge 1 commit into
Open
Conversation
Crystal-wzy
force-pushed
the
main
branch
2 times, most recently
from
July 25, 2026 03:47
646d4a3 to
0afdbd3
Compare
Zhendong404
requested changes
Jul 25, 2026
| func.walk([&](Operation *op) { | ||
| if (isa<pto::TReshapeOp>(op)) | ||
| // TReshapeOp (zero-copy alias) and TPrintOp (cce::printf side effect) are | ||
| // lowered natively by PTOToEmitC (TRESHAPE / TPRINT) with no vector |
Collaborator
There was a problem hiding this comment.
tprint只能在emitc后端用吗?vpto后端的实现方案是什么?
Collaborator
Author
There was a problem hiding this comment.
目前 tprint 只支持 EmitC。EmitC 已有 PTOPrintToTPRINT lowering,能直接生成 pto-isa TPRINT 调用;VPTO 侧目前没有 TPrintOp/TPRINT 的 emission/runtime debug print 实现。因此这版不做 TileLib 模板展开,并在 VPTO backend下遇到 pto.tprint 时显式报 unsupported,避免静默走错路径。后续 VPTO 支持需要先补 VPTO lowering/runtime 的 print side-effect 方案。
Crystal-wzy
force-pushed
the
main
branch
7 times, most recently
from
July 28, 2026 02:59
2c3b929 to
79e7d4c
Compare
Zhendong404
requested changes
Jul 28, 2026
Crystal-wzy
force-pushed
the
main
branch
2 times, most recently
from
July 29, 2026 03:11
acc8e00 to
71e7649
Compare
Add PTODSL support for the native `pto.tprint` debug-print operation and expose it through `pto.tile.print`. The operation is modeled as a device-side side effect, emits no numeric result, and is routed through the native EmitC TPRINT lowering path. ## Summary - Add `_ops.tprint(src, *, tmp=None)` and export it through `pto.tile.print` for tile debug printing, including the optional scratch `tmp` operand - Reject `pto.tile.print` on the VPTO backend with an explicit unsupported diagnostic, while allowing EmitC modules to keep the native `pto.tprint` operation - Treat `TPrintOp` as a native operation in tile expansion and template metadata insertion, so it is not expanded through TileLib templates - Add JIT compile coverage for EmitC `pto.tile.print` lowering and the VPTO unsupported-backend diagnostic - Add an A5 TileLib ST case for `pto.tile.print` using an EmitC kernel and a tile fill -> print sequence - Add a VPTO lit negative case that checks the explicit unsupported diagnostic - Document `pto.tile.print` in the PTODSL user guide, including side-effect behavior, `tmp` handling, dtype coverage, backend support, and A5 constraints ## Testing - [x] `ptodsl/tests/test_jit_compile.py` adds EmitC lowering and VPTO unsupported-backend checks for `pto.tile.print` - [x] `test/lit/vpto/tprint_vpto_unsupported.pto` covers the VPTO unsupported diagnostic for `pto.tprint` - [x] `test/tilelib-st/a5/tprint/case.py` covers the A5 EmitC `pto.tile.print` path with an f32 tile fill and device-side print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add PTODSL support for the native
pto.tprintdebug-print operation andexpose it through
pto.tile.print. The operation is modeled as a device-sideside effect, emits no numeric result, and is routed through the native EmitC
TPRINT lowering path.
Summary
_ops.tprint(src, *, tmp=None)and export it throughpto.tile.printfor tile debug printing, including the optional scratch
tmpoperandpto.tile.printon the VPTO backend with an explicit unsupporteddiagnostic, while allowing EmitC modules to keep the native
pto.tprintoperation
TPrintOpas a native operation in tile expansion and templatemetadata insertion, so it is not expanded through TileLib templates
pto.tile.printlowering and the VPTOunsupported-backend diagnostic
pto.tile.printusing an EmitC kernel and aGM -> tile -> print -> GM round trip
pto.tile.printin the PTODSL user guide, including side-effectbehavior,
tmphandling, dtype coverage, backend support, and A5 constraintsTesting
ptodsl/tests/test_jit_compile.pyadds EmitC lowering and VPTOunsupported-backend checks for
pto.tile.printtest/lit/vpto/tprint_vpto_unsupported.ptocovers the VPTO unsupporteddiagnostic for
pto.tprinttest/tilelib-st/a5/tprint/case.pycovers the A5 EmitCpto.tile.printpath with an f32 round trip