Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Enhancement: Halide IR HTML Visualization #7421

Merged
merged 64 commits into from
Apr 12, 2023
Merged

Conversation

maaz139
Copy link
Contributor

@maaz139 maaz139 commented Mar 14, 2023

Summary

This PR proposes improved printing of Halide IR Stmt code in HTML. In addition to existing features such as syntax highlighting and variable matching, we now provide:

  • A visualization tab that highlights high-level control-flow and structure of the program.
  • An assembly tab that displays the assembly code for the program.
  • Cost indicators (per line in the program) to emphasize critical portions of the program.
  • Interaction between different tabs, allowing users to easily synchronize code with the visualization or assembly.

Demo Screenshot

ir-viz-demo

Credit

This PR is built on top of #7056 and most of the code and ideas were contributed by @darya-ver.

Code Changes

Modified Files

The following files were modified to introduce the new stmt_viz emit flag. When specified, it triggers the generation of <module>.stmt.viz.html file. Note: currently this flag requires the assembly flag to also be set, not doing so results in an error message and compilation is terminated.

To jump from a For or ProducerConsumer node in the visualization to the corresponding line in assembly, we assign unique IDs and print them as comments in the generated assembly:

Build changes, primarily the handling of large template files using binary2cpp:

New Files

The following files contain boilerplate html/js/css code used to generate the visualizations.

The following file contain the new printing code for the IR:

The external interface for the new code is a single print_to_viz function in StmtToViz.h. StmtToViz.cpp contains the following new classes:

  • CostModel; A basic cost model for the Halide programs. It models compute cost as a basic op-count and the data-movement cost as the number of bits moved.
  • AssemblyInfo; Used to map some Halide IR nodes to line-numbers in the assembly file containing the corresponding generated code.
  • HTMLCodePrinter; Prints the Stmt IR as code in HTML.
  • HTMLVisualizationPrinter; Prints the Stmt IR as a visualization in HTML
  • IRVisualizer; The class that generates the output HTML file. Handles all boilerplate code etc.

Testing

I am able to successfully build the following apps with the stmt_viz emit flag. The generated IR/HTML looks correct upon inspection. I am happy to hear ideas for more thorough testing.
- bgu
- bilateral_grid
- blur
- camera pipe
- conv_layer
- depthwise_separable_conv
- fft
- hankk
- harris
- hexagon_benchmarks
- hist
- iir_blur
- interpolate
- lens_blur
- local_laplacian
- max_filter
- nl_means
- resize
- resnet_50
- unsharp
- wavelet

Future Work

  1. The feature still suffers from some scaling issues for very large IR files. Ex: Resnet_50 generates an html file greater than 15mb and fails to render on my machine. JIT rendering is an option that can be implemented down the road if enough folks find this feature useful.
  2. With enough feedback/confidence in the new implementation, we should remove StmtToHtml which offers a strict subset of features..

Marcos Slomp and others added 27 commits September 28, 2022 15:25
Thanks for the feedback everyone! I will merge this into the ir-viz branch and work on it to get it ready for a PR into main.

* initial commit

* updates

* added curr_loop_depth and changed throws for assert(false)

* split into header/cpp file and added test file

* adding changes to move to adobe laptop

* added git ignore to ignore .vscode

* attemping to get add_custom_lowering_pass() to work, not working yet

* Can now compile to stmt_viz files

* moved files into main src folder and added them to Makefile

* fixed lesson_01_basics.cpp

* pushed updates - very messy code

* got side colors working and hiararchy tree. ready for code cleanup

* cleaned up code. ready for split into .h/.cpp files

* quick comment change

* switched everything into .h/.cpp files

* added CostPreProcessor class and removed def of mutate

* removed definitions of mutate

* added data movement costs and bar at the top

* changed location of tooltip so it doesn't overflow left

* updated cost function for laod/store based on vector size and type

* updated colors of hiararchy tree

* logic for deciding context of variables (messy)

* cleaned up code. waiting for marcos

* added context coloring. cleaned up code a bit

* collapse/expand on hiararchy working

* got depth expansion working for hiararchy

* cleaned up code

* cleaned up code and renamed some funcs/vars

* fixed let hierarchy code and added down arrow to button

* dependency graph stuff (still massive and busy)

* Minor fixes -- please review

* prod/cons built with if stmts and for loops

* exit early if running on a module w/ >1 func

* added var dependency button to mail html

* fixed `add` benchmark and made error printing better

* changed `m_assert` to `internal_error`

* cleanedup dependency graph

* added error for non concrete bounds in prodcons hier

* made arrows change btwn up/down depending on sit.

* fixed text for ConsProd tables to have strings

* added logic for non-set bounds for for loop

* added TODO

* added syntax highlight to strings and ints

* added dotdotdot logic for collapsed children

* fixed small bug where 2nd tree wasn't starting correctly

* changed colors of ... nodes based on parent color

* added if flowchart

* added bools for printing different HTML parts of code

* added different background colors per object

* cleaned up borders of objects

* fixed prodCons spacing and started allocate logic

* removed border for ifthenelse table

* implemented anchoring for prodcons tables

* fixed empty if-stmts

* open and close anchor are now right after one another

* added filename logic for anchors and add blocks for func args

* pass in FindStmtCost instead of reruning traversal

* fixed comment

* heatmap for prodConsHierarchy

* fixed consume values (i think) and changed block colors

* fixed allocate "!is_const_one(op->condition" error

* fixed StmtSizes::visit(const For *op) (variables were Add)

* removed nested-ifs logic (edge case we don't have to worry about)

* changed table headers to only show loop interations and no bubbling up

* get unique values for loads with ramp<int, int, int> only

* fixed !is_const_one(op->condition) in Allocate

* changed allocate table to Dim-1, Dim-2, etc

* (1) store: changed cost (2) load: added global/local (3) allocate: vized memtype (4) prodConsTable: changed to read/write

* BOOTSTAP! added navigation pannel at top

* line numbers!!! and removed tooltip (for now)

* changed style of info buttons

* adjusted and added icons for see-code and info buttons

* removed a comment

* condensed cost color classes

* fixed ifthenelse line numbers

* fixed if if-else anchor names

* changed prodCons from table to div

* adding cost colors for prodConsViz to the left side of div

* made long conditions "..." in ProdConsViz

* adding spacing for prodCons start viz and dependency graph viz

* tooltip!!!! (still a little ugly, but functioning!!)

* removed tooltip arrow and changed background to white

* removed arrow for tooltip and added if-stmt condition tooltip

* added more tooltips to prodCons

* getStmtHierarchy popup implemented :) !!

* moved css var definitions to respective files

* added bubble_up() and multiple modules

* converted some stringstream to string + reordered module functions in viz

* added getStmtHierarchy js working for expanding/collapsing

* calculate color ranges once and not every time

* should be added to previous commit

* changed everything from IRMutator -> IRVisitor

* side by side view on main page

* added expand code / viz buttons functionality

* attempting to switch GetStmtHierarchy to 1 tree with colors on side

* should revert this change later, but need to for now (merging with main)

* added Reinterpret + fixed double graph in StmtHierarchy

* removed omg!!!! for reinterpret

* changed border colors of stmtHierarchy + removed print statements

* visualized assert + added colors to assert + made all info buttons next to colors

* added resize bar

* removed navigation code (sticking to 2col layout)

* changed colors spans to buttons (removed segfault???)

* visualize entire LetStmt and cleaned up GetStmtHierarchy.cpp

* added more info in info-buttons

* added hover to side colors in stmthierarchy

* made collapse buttons resizeBar icons + put see_code_button top right of div

* (1) added code to viz buttons (2) display all if-stmts, even if they are empty (3) fixed store highlight cost span

* added scrollTo for function buttons within modules

* changed info-button style

* (1) added hover over for colors in stmtHierarchy (2) removed =default constructor/destructor (3) changed getStmtHierarchy to string html instead of stringstream

* made sure updated StmtToHtml code was in StmtToViz code

* small style changes

* added see code/viz buttons for module functions

* (1) loop size -> loop span (2) made function names  big in viz (3) load types in name

* removed inline style tags

* added VectorReduce code for stmt hierarchy

* removed scopeName hack to fix previous scope error (hope it's not happening anymore)

* fixed scrollTo if code is hidden

* removed commented out includes

* changed costs to inclusive vs exclusive (still might be a bit broken)

* removed print statements

* fixed loop_depth = 0 error

* (1) tooltips include inclusive and exclusive sizes (2) moved tooltip HTML to FindStmtCost.cpp

* reworked tooltip style

* (1) made getStmtHierarchy *exclusive* costs (2) viuslizing costs for IfThenElse blocks

* visualize For and ProducerConsumer blocks

* got collapse of code to show cumulative color cost

* removed context span button

* removed bubble up code and associated logic (now only read/write for loads and stores)

* change some variables to read/write instead of prod/cons

* fixed range bug

* dense/strided vector load

* removed inline TODO comments

* added loop var for for loops

* made loading MUCHHHH faster!!!!

* (1) fixed function box width in viz (2) fixed collapse/expand button for functions in code

* compile assembly if stmt_viz flag is given

* starting assembly stuff

* got assembly code button working (button is still ugly)

* (1) made assembly button prettier (2) started information bar at top (need to fill in content of info popup)

* added content to information bar button popup

* (1) fixed if statement costs (2) added percentages to cost tables instead of values

* removed output_file_name from ProducerConsumerHierarchy.h and related code in StmtToViz.cpp

* fixed IfThenElse cost if there are nested ifs

* removed dependency graph logic and files

* made tooltip table input vector of pairs so that we can specify order

* made tooltip table input vector of pairs so that we can specify order

* added collapse/expand to viz on right

* (1) collapseCode works now (2) search works in assembly tab

* changed codemirror to ARM assembly highlighting

* start of refactor: commenting and cleanup

* fixed bug!!!!! i think. i hope !!!

* removed Stmt function versions (never run this code on Stmt input, only module)

* changed ProdCons stuff to IRViz

* removed print line for strided vectors (seems to be working now)

* fixed bug!!!!!! changed things back to stringstream, because that wasn't the issue

* have helper functions return strings isntead of being void

* end of refactor (for now) - changed variables from camelCase to snake_case

* fix ... error for collapsing nodes

* fixed div issue + tooltips not being correct location

* added error message for multiple modulse (doesn't currently support)

* fixed spacing for boxBody divs

* removed submodules logic because it's not supported right now

* made assembly marker generation more accurate (added counters to have marker names be unique)

* got 3 columns resizing mostly working (just a little glitchy, good enough for now)

* got assembly button to populate assembly, kind of working

* added assemblyInfoViz.h to makefile

* fixed resize bars for 3 different visualizations

* fixed linewrapping issue with codemirror

* updated spacing for IRVisualization buttons in header

* (1) fixed functionBox button sizing (2) dense vector load -> [Dense, Vector] load

* fixed informationBar spacing

* updated InformationBar content

* removed current_loop_depth from consideration of cost

* changed cost table tooltip: inclusive: show %, exclusive: show raw cost

* simplified cost model

* (1) updated InformationBar w/ info for assembly (2) added assembly by default to third col

* added logic to collapseVizAssembly if curson passes resizeBar

* moved all color range + tooltip logic into IRVisualization

* fixed get_combined_color_range() error

* reordered js/css strings

* changed format and slighly changed content of cost tooltips

* refactor: .h and .cpp files have same order

* refactor: added comments

* refactor: updated internal_error messages

* fixed small import / #ifndef typo

* updated get_loop_iterator to include more binary ops for extent

* reverting some changes I made to get ready for PR

* adding CMake build

* refactoring namespace scoping

* refactoring "endl"

* refactoring header guards and includes

* const vector reference

* ostringstream all the things!

* having a symbol for "canIgnoreVariableName"

* string -> char*, with raw string literal

* internal_error -> internal_assert()

* clang-format

* if-else chain to switch-case block

* Upgrade wabt to 1.0.30 (#7058)

* Add support for float16 buffer in python extension (#7060)

* run clang-tidy and clang-format

* run clang-tidy & clang-format

* run clang-tidy and clang-format, again

* run clang-tidy and clang-format, Phaze III

* Minor PR Revision

- If `stmt_viz` flag is used without the `assembly` flag, the compiler throws an error.
- GetAssemblyInfoViz.cpp: replace regex with replace_all
- GetSttmtHierarchy.cpp: Bug fix (line 721). Use raw strings for large literals
- Restricted scope of default statement values
- Added enum type for StmtCostModel. A single cost model config value is specified, instead of multiple booleans.

* reminder for later

---------

Co-authored-by: Darya Verzhbinsky <[email protected]>
Co-authored-by: Maaz Ahmad <[email protected]>
Co-authored-by: Marcos Slomp <[email protected]>
Co-authored-by: Steven Johnson <[email protected]>
Co-authored-by: Steve Suzuki <[email protected]>
Co-authored-by: Marcos Slomp <[email protected]>
- Disabled legacy StmtToViz implementation
- Introduced three new classes instead:
   - IRVisualizer: generates the output page (WIP)
   - HTMLCodePrinter: prints IR code in HTML (Implementation complete)
   - HTMLVisualizationPrinter: visualizes IR code in HTML (WIP)
Thorough refactor of css and js pending
Refactored all visualization logic into a single HTMLVisualizationPrinter class
- Visual improvements
- Deleted unnecessary code
- Refactored most of js code
- Deleted unused code
- Simplified remaining code
- Added assembly tab functionality
- Jump to assembly buttons added
- Tooltips added for all buttons
These classes were simplified and refactored into the new StmtToViz file.
- Cost model is much simpler now
- Re-integrated cost model into code tab
- Re-integration to viz tab pending
@steven-johnson
Copy link
Contributor

(Clarification: does this replace #7056 or build on top of it? I'm not entirely sure based on your comment)

@maaz139 maaz139 self-assigned this Mar 14, 2023
@maaz139 maaz139 added the enhancement New user-visible features or improvements to existing features. label Mar 14, 2023
src/StmtToViz.cpp Outdated Show resolved Hide resolved
src/StmtToViz.cpp Outdated Show resolved Hide resolved
- Fix type in fn name `compute_all_costs`
- Comments describing class are now in format consistent with rest of the codebase
- Improved comment describing `print_cuda_gpu_source_kernels`
src/StmtToViz.cpp Outdated Show resolved Hide resolved
@maaz139
Copy link
Contributor Author

maaz139 commented Apr 11, 2023

Thanks again everyone for you comments. I've opened issues to track the handful of comments that have not already been addressed. Will go ahead and merge this PR now. Please tag me on any issues/feature requests relating to the IR visualizer! :)

Edit: Doh! Just saw the build failure -- will fix before merge :)

@steven-johnson
Copy link
Contributor

The arm32 buildbot failure is unrelated -- the overnight LLVM build was busted for 32-bit codegen. OK to land.

@maaz139 maaz139 merged commit 24f1bdd into main Apr 12, 2023
@steven-johnson steven-johnson added the release_notes For changes that may warrant a note in README for official releases. label Apr 12, 2023
steven-johnson added a commit that referenced this pull request Apr 13, 2023
This is to augment #7421 and add some missing build-and-test support bits that got overlooked, including output from the CMake generator rules, some Python support issues, README, tutorial, and multitarget output.
@maaz139 maaz139 deleted the darya-ver/ir-viz branch August 30, 2023 21:36
ardier pushed a commit to ardier/Halide-mutation that referenced this pull request Mar 3, 2024
* placeholder for IR visualization work from Darya Verzhbinsky

* placeholder for IR visualization work from Darya Verzhbinsky

* New Feature: Halide Program IR Visualizer (halide#7056)

Thanks for the feedback everyone! I will merge this into the ir-viz branch and work on it to get it ready for a PR into main.

* initial commit

* updates

* added curr_loop_depth and changed throws for assert(false)

* split into header/cpp file and added test file

* adding changes to move to adobe laptop

* added git ignore to ignore .vscode

* attemping to get add_custom_lowering_pass() to work, not working yet

* Can now compile to stmt_viz files

* moved files into main src folder and added them to Makefile

* fixed lesson_01_basics.cpp

* pushed updates - very messy code

* got side colors working and hiararchy tree. ready for code cleanup

* cleaned up code. ready for split into .h/.cpp files

* quick comment change

* switched everything into .h/.cpp files

* added CostPreProcessor class and removed def of mutate

* removed definitions of mutate

* added data movement costs and bar at the top

* changed location of tooltip so it doesn't overflow left

* updated cost function for laod/store based on vector size and type

* updated colors of hiararchy tree

* logic for deciding context of variables (messy)

* cleaned up code. waiting for marcos

* added context coloring. cleaned up code a bit

* collapse/expand on hiararchy working

* got depth expansion working for hiararchy

* cleaned up code

* cleaned up code and renamed some funcs/vars

* fixed let hierarchy code and added down arrow to button

* dependency graph stuff (still massive and busy)

* Minor fixes -- please review

* prod/cons built with if stmts and for loops

* exit early if running on a module w/ >1 func

* added var dependency button to mail html

* fixed `add` benchmark and made error printing better

* changed `m_assert` to `internal_error`

* cleanedup dependency graph

* added error for non concrete bounds in prodcons hier

* made arrows change btwn up/down depending on sit.

* fixed text for ConsProd tables to have strings

* added logic for non-set bounds for for loop

* added TODO

* added syntax highlight to strings and ints

* added dotdotdot logic for collapsed children

* fixed small bug where 2nd tree wasn't starting correctly

* changed colors of ... nodes based on parent color

* added if flowchart

* added bools for printing different HTML parts of code

* added different background colors per object

* cleaned up borders of objects

* fixed prodCons spacing and started allocate logic

* removed border for ifthenelse table

* implemented anchoring for prodcons tables

* fixed empty if-stmts

* open and close anchor are now right after one another

* added filename logic for anchors and add blocks for func args

* pass in FindStmtCost instead of reruning traversal

* fixed comment

* heatmap for prodConsHierarchy

* fixed consume values (i think) and changed block colors

* fixed allocate "!is_const_one(op->condition" error

* fixed StmtSizes::visit(const For *op) (variables were Add)

* removed nested-ifs logic (edge case we don't have to worry about)

* changed table headers to only show loop interations and no bubbling up

* get unique values for loads with ramp<int, int, int> only

* fixed !is_const_one(op->condition) in Allocate

* changed allocate table to Dim-1, Dim-2, etc

* (1) store: changed cost (2) load: added global/local (3) allocate: vized memtype (4) prodConsTable: changed to read/write

* BOOTSTAP! added navigation pannel at top

* line numbers!!! and removed tooltip (for now)

* changed style of info buttons

* adjusted and added icons for see-code and info buttons

* removed a comment

* condensed cost color classes

* fixed ifthenelse line numbers

* fixed if if-else anchor names

* changed prodCons from table to div

* adding cost colors for prodConsViz to the left side of div

* made long conditions "..." in ProdConsViz

* adding spacing for prodCons start viz and dependency graph viz

* tooltip!!!! (still a little ugly, but functioning!!)

* removed tooltip arrow and changed background to white

* removed arrow for tooltip and added if-stmt condition tooltip

* added more tooltips to prodCons

* getStmtHierarchy popup implemented :) !!

* moved css var definitions to respective files

* added bubble_up() and multiple modules

* converted some stringstream to string + reordered module functions in viz

* added getStmtHierarchy js working for expanding/collapsing

* calculate color ranges once and not every time

* should be added to previous commit

* changed everything from IRMutator -> IRVisitor

* side by side view on main page

* added expand code / viz buttons functionality

* attempting to switch GetStmtHierarchy to 1 tree with colors on side

* should revert this change later, but need to for now (merging with main)

* added Reinterpret + fixed double graph in StmtHierarchy

* removed omg!!!! for reinterpret

* changed border colors of stmtHierarchy + removed print statements

* visualized assert + added colors to assert + made all info buttons next to colors

* added resize bar

* removed navigation code (sticking to 2col layout)

* changed colors spans to buttons (removed segfault???)

* visualize entire LetStmt and cleaned up GetStmtHierarchy.cpp

* added more info in info-buttons

* added hover to side colors in stmthierarchy

* made collapse buttons resizeBar icons + put see_code_button top right of div

* (1) added code to viz buttons (2) display all if-stmts, even if they are empty (3) fixed store highlight cost span

* added scrollTo for function buttons within modules

* changed info-button style

* (1) added hover over for colors in stmtHierarchy (2) removed =default constructor/destructor (3) changed getStmtHierarchy to string html instead of stringstream

* made sure updated StmtToHtml code was in StmtToViz code

* small style changes

* added see code/viz buttons for module functions

* (1) loop size -> loop span (2) made function names  big in viz (3) load types in name

* removed inline style tags

* added VectorReduce code for stmt hierarchy

* removed scopeName hack to fix previous scope error (hope it's not happening anymore)

* fixed scrollTo if code is hidden

* removed commented out includes

* changed costs to inclusive vs exclusive (still might be a bit broken)

* removed print statements

* fixed loop_depth = 0 error

* (1) tooltips include inclusive and exclusive sizes (2) moved tooltip HTML to FindStmtCost.cpp

* reworked tooltip style

* (1) made getStmtHierarchy *exclusive* costs (2) viuslizing costs for IfThenElse blocks

* visualize For and ProducerConsumer blocks

* got collapse of code to show cumulative color cost

* removed context span button

* removed bubble up code and associated logic (now only read/write for loads and stores)

* change some variables to read/write instead of prod/cons

* fixed range bug

* dense/strided vector load

* removed inline TODO comments

* added loop var for for loops

* made loading MUCHHHH faster!!!!

* (1) fixed function box width in viz (2) fixed collapse/expand button for functions in code

* compile assembly if stmt_viz flag is given

* starting assembly stuff

* got assembly code button working (button is still ugly)

* (1) made assembly button prettier (2) started information bar at top (need to fill in content of info popup)

* added content to information bar button popup

* (1) fixed if statement costs (2) added percentages to cost tables instead of values

* removed output_file_name from ProducerConsumerHierarchy.h and related code in StmtToViz.cpp

* fixed IfThenElse cost if there are nested ifs

* removed dependency graph logic and files

* made tooltip table input vector of pairs so that we can specify order

* made tooltip table input vector of pairs so that we can specify order

* added collapse/expand to viz on right

* (1) collapseCode works now (2) search works in assembly tab

* changed codemirror to ARM assembly highlighting

* start of refactor: commenting and cleanup

* fixed bug!!!!! i think. i hope !!!

* removed Stmt function versions (never run this code on Stmt input, only module)

* changed ProdCons stuff to IRViz

* removed print line for strided vectors (seems to be working now)

* fixed bug!!!!!! changed things back to stringstream, because that wasn't the issue

* have helper functions return strings isntead of being void

* end of refactor (for now) - changed variables from camelCase to snake_case

* fix ... error for collapsing nodes

* fixed div issue + tooltips not being correct location

* added error message for multiple modulse (doesn't currently support)

* fixed spacing for boxBody divs

* removed submodules logic because it's not supported right now

* made assembly marker generation more accurate (added counters to have marker names be unique)

* got 3 columns resizing mostly working (just a little glitchy, good enough for now)

* got assembly button to populate assembly, kind of working

* added assemblyInfoViz.h to makefile

* fixed resize bars for 3 different visualizations

* fixed linewrapping issue with codemirror

* updated spacing for IRVisualization buttons in header

* (1) fixed functionBox button sizing (2) dense vector load -> [Dense, Vector] load

* fixed informationBar spacing

* updated InformationBar content

* removed current_loop_depth from consideration of cost

* changed cost table tooltip: inclusive: show %, exclusive: show raw cost

* simplified cost model

* (1) updated InformationBar w/ info for assembly (2) added assembly by default to third col

* added logic to collapseVizAssembly if curson passes resizeBar

* moved all color range + tooltip logic into IRVisualization

* fixed get_combined_color_range() error

* reordered js/css strings

* changed format and slighly changed content of cost tooltips

* refactor: .h and .cpp files have same order

* refactor: added comments

* refactor: updated internal_error messages

* fixed small import / #ifndef typo

* updated get_loop_iterator to include more binary ops for extent

* reverting some changes I made to get ready for PR

* adding CMake build

* refactoring namespace scoping

* refactoring "endl"

* refactoring header guards and includes

* const vector reference

* ostringstream all the things!

* having a symbol for "canIgnoreVariableName"

* string -> char*, with raw string literal

* internal_error -> internal_assert()

* clang-format

* if-else chain to switch-case block

* Upgrade wabt to 1.0.30 (halide#7058)

* Add support for float16 buffer in python extension (halide#7060)

* run clang-tidy and clang-format

* run clang-tidy & clang-format

* run clang-tidy and clang-format, again

* run clang-tidy and clang-format, Phaze III

* Minor PR Revision

- If `stmt_viz` flag is used without the `assembly` flag, the compiler throws an error.
- GetAssemblyInfoViz.cpp: replace regex with replace_all
- GetSttmtHierarchy.cpp: Bug fix (line 721). Use raw strings for large literals
- Restricted scope of default statement values
- Added enum type for StmtCostModel. A single cost model config value is specified, instead of multiple booleans.

* reminder for later

---------

Co-authored-by: Darya Verzhbinsky <[email protected]>
Co-authored-by: Maaz Ahmad <[email protected]>
Co-authored-by: Marcos Slomp <[email protected]>
Co-authored-by: Steven Johnson <[email protected]>
Co-authored-by: Steve Suzuki <[email protected]>
Co-authored-by: Marcos Slomp <[email protected]>

* Refactor 1/N: Moved all static html, css and js code outside of the cpp files to reduce noise

* Refactor 2/N: Broke down StmtToViz Class to two simpler classes

- Disabled legacy StmtToViz implementation
- Introduced three new classes instead:
   - IRVisualizer: generates the output page (WIP)
   - HTMLCodePrinter: prints IR code in HTML (Implementation complete)
   - HTMLVisualizationPrinter: visualizes IR code in HTML (WIP)

* Refactor 3/N: Minor stylesheet and javascript improvements

Thorough refactor of css and js pending

* Fixed resize bars not working properly

* Refactoring Viz tab (WIP)

* Refactored 4/N: Visualization tab complete

Refactored all visualization logic into a single HTMLVisualizationPrinter class

* Refactor 5/N: Javascript and css cleanup

- Visual improvements
- Deleted unnecessary code
- Refactored most of js code

* Refactor 6/N: JS and CSS refactor complete

- Deleted unused code
- Simplified remaining code

* Refactor 7/N: Added assembly support

- Added assembly tab functionality
- Jump to assembly buttons added
- Tooltips added for all buttons

* Refactor 8/N: Deleted info bar

* Refactor 9/N: Deleting code

These classes were simplified and refactored into the new StmtToViz file.

* Remove stale files from build

* Refactor 10/N: Cost model simplified and re-activated

- Cost model is much simpler now
- Re-integrated cost model into code tab
- Re-integration to viz tab pending

* Delete stale cost model code

* Refactor 11/N: Reintegrate cost model into visualization

* Minor fixes

* Update CMakeLists.txt

* Deleting more stale files

* Improved documentation for new code in Codegen_LLVM

* Static HTML, CSS and JS is now stored as large strings

Avoids build shenanigans.

* Fix: Build error for unused variable

* Deleting dead code

* Stmt visualizer should not run on submodules

* Ran clang-format on the PR

* Ran clang-tidy on the PR

* Move boilerplate JS/CSS code into template files

* CMake Build fix: Typo

* Minor bug fix

* Renamed variable to avoid any keyword conflict

* Style fixes

- Removed underscore-prefix on member variables
- Fixed typos in documentation
- Fixed indentation in Makefile

* Replacing `internal_assert(false) << ...` with `internal_error << ...`

* Style improvement: std prefix consistency

* Minor fix: variable had greater scope than necessary

* Renamed `datamovement` to `data_movement` for readability

* Constructor fixes for HTMLCodePrinter, HTMLVizualizationPrinter and IRVisualizer

- Made single parameter constructors explicit
- Made HTMLCodePrinter and HTMLVizualizationPrinter non-moveable and non-copyable

* Typo

* Clang-formatting

* Undo accidental Makefile change

* Improved comments

- Fix type in fn name `compute_all_costs`
- Comments describing class are now in format consistent with rest of the codebase
- Improved comment describing `print_cuda_gpu_source_kernels`

* Replaced spaces with underscores in regex markers printed in assembly

* Minor bug fix for Halide IR Visualizer

Synchronization button from Viz to Code was not working for tail `else` cases.

* Clang format fix

* Assign deterministic node IDs for reproducability

* clang-format and clang-tidy

* Update StmtToViz.cpp

* Minor formatting fix

* Bug fix: ProducerConsumer IDs were not generated correctly

---------

Co-authored-by: Marcos Slomp <[email protected]>
Co-authored-by: darya-ver <[email protected]>
Co-authored-by: Darya Verzhbinsky <[email protected]>
Co-authored-by: Steven Johnson <[email protected]>
Co-authored-by: Steve Suzuki <[email protected]>
Co-authored-by: Marcos Slomp <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New user-visible features or improvements to existing features. release_notes For changes that may warrant a note in README for official releases.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants