Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature Enhancement: Halide IR HTML Visualization (halide#7421)
* 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 <dverzhbinsky@adobe.com> Co-authored-by: Maaz Ahmad <maaz.c10@gmail.com> Co-authored-by: Marcos Slomp <slomp@adobe.com> Co-authored-by: Steven Johnson <srj@google.com> Co-authored-by: Steve Suzuki <shinsuke.suzuki@arm.com> Co-authored-by: Marcos Slomp <mslomp@gmail.com> * 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 <slomp@adobe.com> Co-authored-by: darya-ver <darya99@gmail.com> Co-authored-by: Darya Verzhbinsky <dverzhbinsky@adobe.com> Co-authored-by: Steven Johnson <srj@google.com> Co-authored-by: Steve Suzuki <shinsuke.suzuki@arm.com> Co-authored-by: Marcos Slomp <mslomp@gmail.com>
- Loading branch information