feat: Add tprint and treshape tilelib tile ops#994
Open
Crystal-wzy wants to merge 1 commit into
Open
Conversation
Add the pto.tprint debug-print tile op and an A5 template for the
existing pto.treshape op to the PTODSL TileLib for the A5 target, with
frontend API, templates, catalog entries, an ExpandTileOp lowering fix,
system tests, and user-guide documentation. Both ops are native
(ExpandTileOp skips them and PTOToEmitC lowers them to TPRINT/TRESHAPE
directly), so their templates exist for catalog completeness only.
## Summary
- Add pto.tprint (device-side debug print of a tile: the A5 CCE
TPRINT_IMPL Vec path, cce::printf over the tile; a pure side effect
with no numeric result, so the call returns None and the op is not
fusible) DSL op in _ops.py, and expose it as pto.tprint /
pto.tile.print. A Unified-Buffer (vec) tile prints directly; an
accumulator tile may pass a scratch GlobalTensor tmp to stage the
copy to GM. The CCE printFormat template argument is not exposed
(the installed MLIR build lacks a PTO_PrintFormatAttr builder), so
the default format is used
- Add A5 TileLib templates template_tprint (ports A5 CCE TPRINT_IMPL:
cce::printf with no vector compute and no dst, non-fusible) and
template_treshape (ports A5 CCE TRESHAPE_IMPL: zero-copy
__cce_alias storage alias, gated by a byte-size-equal constraint)
- Register both templates in the a5 catalog and add catalog entries,
plus a test_tprint_and_treshape_native_catalog_entries test. Since
the ops are native, selection (not vector render) is the right
coverage
- Fix ExpandTileOp.cpp to also skip TPrintOp (alongside the existing
TReshapeOp skip) in the tile-op walk, because both are lowered
natively by PTOToEmitC (TPRINT / TRESHAPE) with no vector
decomposition
- Add system tests under test/tilelib-st/a5/{tprint, treshape}:
tprint is run-only (no golden) across f32/i32/i8 at 1x8, 1x32, and
2x8 -- coverage mirroring the pto-isa C++ TPRINT ST cases; treshape
is golden-output for byte-equal rank-2 reshapes (f32 2x16->1x32,
16x16->1x256, 16x16->32x8)
- Document pto.tile.print in 04-type-system-and-buffer.md (section
4.11 Tile Debug Print)
## Testing
- [x] All tests pass (fill in total count after running the suite)
- [x] Code review completed
- [x] Pre-commit hooks pass (clang-format, cpplint, ruff, pyright,
markdownlint)
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 the pto.tprint debug-print tile op and an A5 template for the existing pto.treshape op to the PTODSL TileLib for the A5 target, with frontend API, templates, catalog entries, an ExpandTileOp lowering fix, system tests, and user-guide documentation. Both ops are native (ExpandTileOp skips them and PTOToEmitC lowers them to TPRINT/TRESHAPE directly), so their templates exist for catalog completeness only.
Summary
Testing