-
Notifications
You must be signed in to change notification settings - Fork 30
[Feature] Improve !pto.tile_buf IR readability by eliding default fields and supporting aliases #331
Description
Problem
The current custom assembly printer for !pto.tile_buf always prints the full parameter list:
locdtyperowscolsv_rowv_colblayoutslayoutfractalpad
This makes PTO IR very hard to read in fusion-heavy regions, because the same long type string is repeated on nearly every operand/result.
The current behavior comes from the custom parser/printer in lib/PTO/IR/PTOTypeDefs.cpp:
TileBufType::parse: currently expects the full keyed form in a fixed orderTileBufType::print: currently always emits the full keyed form
Example
From a real IR dump in this checkout:
pto.tmax ins(%arg9, %arg10 : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>) outs(%arg11 : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
pto.tsub ins(%arg9, %arg11 : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>, !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>) outs(%arg12 : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>)When this appears inside pto.fusion_region, block arguments, yields, and function-like signatures all become visually dominated by repeated type text rather than the actual dataflow.
Why this matters
This is mainly a readability and debugging problem:
- reviewing fusion/grouping/scheduling output is slower than necessary
- IR diffs become noisy
- region signatures and
pto.yieldlines become much harder to scan - repeated default config values hide the semantically important differences
Suggested direction
I suggest keeping the current verbose syntax parseable for backward compatibility, but changing the default printer to a more compact form.
1. Elide redundant/default fields in the default printer
Possible rules:
- omit
v_row/v_colwhen they are equal torows/cols - omit config fields when the config is the dialect default
blayout=row_majorslayout=none_boxfractal=512pad=0
- compress
rows + cols + dtypeinto a shaped form such as1x16xf32
For example:
Current:
!pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>Possible compact default:
!pto.tile_buf<vec, 1x16xf32>And when valid shape / layout differ from defaults:
!pto.tile_buf<vec, 16x128xf32, valid=16x1, blayout=col_major>2. Support type aliases for repeated tile_buf instances
For very repetitive IR, consider adding an OpAsmDialectInterface alias path so repeated identical tile types can print once and then be referenced via a short alias.
For example:
!pto.tb0 = !pto.tile_buf<vec, 1x16xf32>Then ops can use !pto.tb0 instead of repeating the full type.
3. Keep a verbose/debug path available
If full information is still useful for debugging, we can keep either:
- the current syntax accepted by the parser
- an explicit verbose printing mode / debug flag
That way we improve default readability without losing inspectability.
Expected outcome
- shorter and more readable IR dumps
- much cleaner fusion-region and block-argument printing
- lower diff noise
- no semantic change to
tile_buf - backward-compatible parser behavior
Scope
This request is only about assembly syntax / textual readability. It does not request any change to tile semantics, layout semantics, or type invariants.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status