Repository navigation
Print the stmt html with IRPrinter (simplified alternative to #9690) - #9711
mcourteaux wants to merge 1 commit into
Conversation
a03c418 to
e6e8fe2
Compare
|
Why remove the cost model? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9711 +/- ##
==========================================
+ Coverage 73.25% 73.47% +0.21%
==========================================
Files 266 266
Lines 83749 82593 -1156
Branches 20572 20482 -90
==========================================
- Hits 61352 60685 -667
+ Misses 15845 15395 -450
+ Partials 6552 6513 -39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Because I think nobody is using it. It's a poor visualization of how many bytes are moved (expressed as bits). Correct me if I'm wrong. |
|
Code changes look reasonable but it took me a long time to figure out how to jump from the stmt to the assembly. The dotted underline on the line number is too subtle. Can the clickable lines be made clearer in some way? Personally I liked the arrows at the right end of the line, but if that's hard it could just be a different styling on the clickable line numbers. |
The html output is written by HTMLStmtPrinter, a subclass of IRPrinter, through new hooks: begin_style()/end_style() for styled text, and begin_node()/end_node() around each Expr and Stmt. It shows the IR exactly as the stmt output prints it, which replaces the separate html printer. IRPrinter is simplified along the way: the colors of the styles come from a table, Modules and LoweredFuncs are printed by member functions that operator<< uses, the binary operators share a helper, and chained ifs are printed recursively. Colored output ends some styles by resetting only the color where it reset all attributes; plain output is unchanged. The variables of the loops over GPU threads (.thread_id_x, .thread_id_y and .thread_id_z) are red, green and blue, in colored output and in the html. The assembly is linked to the loops and produce/consume blocks by the names of their basic blocks. It is written as plain text into a <script type='text/plain'>, which the page splits into lines and renders as they come into view. The cost model is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FRemhS639vq75urwV44oe
e6e8fe2 to
0a5e349
Compare
I agree, but didn't bother because the follow-up PRs make every Expr clickable. I may perhaps bring back the jump-to-buttons on important things, like loops and ifs, if desirable. So I recommend you try the next PR too, and let me know what would be preferred. |
Stacked on #9710. Draft: this is a simplified alternative to #9690, for comparing the two side by side.
What this does
The html output is written by
HTMLStmtPrinter, a subclass ofIRPrinter, instead of by a separate printer of its own. It shows the IR exactly as the stmt output prints it.IRPrintergets the hooks for that:begin_style()/end_style()around styled text, andbegin_node()/end_node()around each Expr and Stmt.The assembly is linked to the loops and produce/consume blocks by the names of their basic blocks, as before.
What is different from #9690
<script type='text/plain'>, which the page splits into lines, instead of as an array of JavaScript string literals. Long lines are still truncated while writing. Only the IR line of each assembly line is kept in memory.IRPrinteris simplified:StyledTextonly carries the style. The nesting depth of punctuation is the printer's, and how a style ends follows from the style.operator<<uses..thread_id_x,.thread_id_yand.thread_id_z) are red, green and blue, in the colored output ofIRPrinterand in the html.StmtToHTML, the classes of the styles come from a table, the device code pane is written in place, and the lines are not copied to print them.Screenshots
Taken with headless Chrome, of a small tiled and vectorized pipeline.
The line of a loop clicked, with the assembly of its basic block highlighted:
An OpenCL pipeline, with its device code pane. The variables of the loops over GPU threads have their own colors:
Output
The plain output of
IRPrinteris unchanged. I compared the IR that two tests print withHL_DEBUG_CODEGEN=2against the code before the simplification: it differs only in pointer addresses and paths.The colored output ends some styles (immediates, and types in parentheses) by resetting only the color (
\033[39m) where it reset all attributes (\033[0m), which looks the same in a terminal.Tests
correctness_stmt_to_htmlchecks that the html shows the IR exactly as the stmt output prints it, that loops are linked to their assembly, and that the assembly text has one link per line.🤖 Generated with Claude Code
https://claude.ai/code/session_011FRemhS639vq75urwV44oe