From 6f87454d5f377df94718104afbec2ea2688a2d02 Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Mon, 24 Jun 2024 15:53:39 +0200 Subject: [PATCH 1/4] A few color tweaks for a darker colorscheme. --- src/irvisualizer/html_template_StmtToHTML.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/irvisualizer/html_template_StmtToHTML.css b/src/irvisualizer/html_template_StmtToHTML.css index 1b1d718b55ee..14e96876e989 100644 --- a/src/irvisualizer/html_template_StmtToHTML.css +++ b/src/irvisualizer/html_template_StmtToHTML.css @@ -231,6 +231,15 @@ b.HighlightToggle3 { font-weight: bold; background-color: oklch(80% 0.18 150); } b.HighlightToggle4 { font-weight: bold; background-color: oklch(80% 0.18 200); } b.HighlightToggle5 { font-weight: bold; background-color: oklch(80% 0.18 260); } b.HighlightToggle6 { font-weight: bold; background-color: oklch(80% 0.18 310); } +@media (prefers-color-scheme: dark) { + b.HighlightToggle0 { background-color: oklch(40% 0.18 0); } + b.HighlightToggle1 { background-color: oklch(40% 0.18 50); } + b.HighlightToggle2 { background-color: oklch(40% 0.18 100); } + b.HighlightToggle3 { background-color: oklch(40% 0.18 150); } + b.HighlightToggle4 { background-color: oklch(40% 0.18 200); } + b.HighlightToggle5 { background-color: oklch(40% 0.18 260); } + b.HighlightToggle6 { background-color: oklch(40% 0.18 310); } +} span.OpF32 { color: hsl(106deg 100% 40%); From c757e3d07c1235548ae1f68837f121eb2dd4a2e4 Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Wed, 26 Jun 2024 13:54:55 +0200 Subject: [PATCH 2/4] Dark color scheme for Stmt HTML. Ability to programatically export the conceptual stmt files. --- src/Func.cpp | 7 + src/Func.h | 8 + src/Pipeline.cpp | 8 + src/Pipeline.h | 8 + src/irvisualizer/generate_palettes.py | 55 ++-- src/irvisualizer/html_template_StmtToHTML.css | 268 +++++++++++++----- ...html_template_StmtToHTML_dependencies.html | 67 ++++- 7 files changed, 320 insertions(+), 101 deletions(-) diff --git a/src/Func.cpp b/src/Func.cpp index 3373348d37a9..29c1427274bc 100644 --- a/src/Func.cpp +++ b/src/Func.cpp @@ -3542,6 +3542,13 @@ void Func::compile_to_lowered_stmt(const string &filename, pipeline().compile_to_lowered_stmt(filename, args, fmt, target); } +void Func::compile_to_conceptual_stmt(const string &filename, + const vector &args, + StmtOutputFormat fmt, + const Target &target) { + pipeline().compile_to_conceptual_stmt(filename, args, fmt, target); +} + void Func::print_loop_nest() { pipeline().print_loop_nest(); } diff --git a/src/Func.h b/src/Func.h index f63195beb082..32d8f1e58c69 100644 --- a/src/Func.h +++ b/src/Func.h @@ -954,6 +954,14 @@ class Func { StmtOutputFormat fmt = Text, const Target &target = get_target_from_environment()); + /** Write out a conceptual representation of lowered code, before any parallel loop + * get factored out into separate functions, or GPU loops are offloaded to kernel code.r + * Useful for analyzing and debugging scheduling. Can emit html or plain text. */ + void compile_to_conceptual_stmt(const std::string &filename, + const std::vector &args, + StmtOutputFormat fmt = Text, + const Target &target = get_target_from_environment()); + /** Write out the loop nests specified by the schedule for this * Function. Helpful for understanding what a schedule is * doing. */ diff --git a/src/Pipeline.cpp b/src/Pipeline.cpp index 79d1701a2593..9109c0dd4ac1 100644 --- a/src/Pipeline.cpp +++ b/src/Pipeline.cpp @@ -356,6 +356,14 @@ void Pipeline::compile_to_lowered_stmt(const string &filename, m.compile(single_output(filename, m, fmt == HTML ? OutputFileType::stmt_html : OutputFileType::stmt)); } +void Pipeline::compile_to_conceptual_stmt(const string &filename, + const vector &args, + StmtOutputFormat fmt, + const Target &target) { + Module m = compile_to_module(args, "", target); + m.compile(single_output(filename, m, fmt == HTML ? OutputFileType::conceptual_stmt_html : OutputFileType::conceptual_stmt)); +} + void Pipeline::compile_to_static_library(const string &filename_prefix, const vector &args, const std::string &fn_name, diff --git a/src/Pipeline.h b/src/Pipeline.h index 37537db04fb7..ef3e5f11eca3 100644 --- a/src/Pipeline.h +++ b/src/Pipeline.h @@ -281,6 +281,14 @@ class Pipeline { StmtOutputFormat fmt = Text, const Target &target = get_target_from_environment()); + /** Write out a conceptual representation of lowered code, before any parallel loop + * get factored out into separate functions, or GPU loops are offloaded to kernel code.r + * Useful for analyzing and debugging scheduling. Can emit html or plain text. */ + void compile_to_conceptual_stmt(const std::string &filename, + const std::vector &args, + StmtOutputFormat fmt = Text, + const Target &target = get_target_from_environment()); + /** Write out the loop nests specified by the schedule for this * Pipeline's Funcs. Helpful for understanding what a schedule is * doing. */ diff --git a/src/irvisualizer/generate_palettes.py b/src/irvisualizer/generate_palettes.py index 7c6f43d23704..31aea68784e3 100644 --- a/src/irvisualizer/generate_palettes.py +++ b/src/irvisualizer/generate_palettes.py @@ -3,32 +3,37 @@ def make_oklch(l, c, h): STEPS = 20 +for color_theme, fL in [("light", 1.0), ("dark", 0.7)]: + print() + print("/* Color theme", color_theme, "*/") + print("@media (prefers-color-scheme:", color_theme, ") {") + print() + for i in range(STEPS): + f = i / (STEPS - 1) + col = make_oklch((0.9 - f * 0.5) * fL, 0.05 + 0.1 * f, 140) + print(".block-CostColor%d:first-child { border-left: 8px solid %s; }" % (i, col)) + print(".block-CostColorNone:first-child { border-left: transparent; }") + print() -for i in range(STEPS): - f = i / (STEPS - 1) - col = make_oklch(0.9 - f * 0.5, 0.05 + 0.1 * f, 140) - print(".block-CostColor%d:first-child { border-left: 8px solid %s; }" % (i, col)) -print(".block-CostColorNone:first-child { border-left: transparent; }") -print() + for i in range(STEPS): + f = i / (STEPS - 1) + col = make_oklch((0.9 - f * 0.5) * fL, 0.05 + 0.1 * f, 140) + print(".line-CostColor%d:first-child { border-right: 8px solid %s; }" % (i, col)) + print(".line-CostColorNone:first-child { border-right: transparent; }") + print() -for i in range(STEPS): - f = i / (STEPS - 1) - col = make_oklch(0.9 - f * 0.5, 0.05 + 0.1 * f, 140) - print(".line-CostColor%d:first-child { border-right: 8px solid %s; }" % (i, col)) -print(".line-CostColorNone:first-child { border-right: transparent; }") -print() + for i in range(STEPS): + f = i / (STEPS - 1) + col = make_oklch((0.9 - f * 0.5) * fL, 0.05 + 0.1 * f, 300) + print(".block-CostColor%d:last-child { border-left: 8px solid %s; }" % (i, col)) + print(".block-CostColorNone:last-child { border-left: transparent; }") + print() -for i in range(STEPS): - f = i / (STEPS - 1) - col = make_oklch(0.9 - f * 0.5, 0.05 + 0.1 * f, 300) - print(".block-CostColor%d:last-child { border-left: 8px solid %s; }" % (i, col)) -print(".block-CostColorNone:last-child { border-left: transparent; }") -print() - -for i in range(STEPS): - f = i / (STEPS - 1) - col = make_oklch(0.9 - f * 0.5, 0.05 + 0.1 * f, 300) - print(".line-CostColor%d:last-child { border-right: 8px solid %s; }" % (i, col)) -print(".line-CostColorNone:last-child { border-right: transparent; }") -print() + for i in range(STEPS): + f = i / (STEPS - 1) + col = make_oklch((0.9 - f * 0.5) * fL, 0.05 + 0.1 * f, 300) + print(".line-CostColor%d:last-child { border-right: 8px solid %s; }" % (i, col)) + print(".line-CostColorNone:last-child { border-right: transparent; }") + print() + print("} /* End of", color_theme, "theme. */") diff --git a/src/irvisualizer/html_template_StmtToHTML.css b/src/irvisualizer/html_template_StmtToHTML.css index 14e96876e989..39a47cf31fc6 100644 --- a/src/irvisualizer/html_template_StmtToHTML.css +++ b/src/irvisualizer/html_template_StmtToHTML.css @@ -65,6 +65,13 @@ div#ir-code-pane { width: 50vw; } +@media (prefers-color-scheme: dark) { + body { + background-color: #141617; + color: #d4be98; + } +} + div#host-assembly-pane { width: 20vw; } @@ -136,6 +143,18 @@ div.resize-bar > div.collapse-btns button.collapse-right.active:before { content: "<<"; } + +@media (prefers-color-scheme: dark) { +div.resize-bar { + background: rgb(101, 111, 96); + border-left: 1px solid rgb(120, 130, 105); + border-right: 1px solid rgb(120, 130, 105); +} +div.collapse-btns *:before { + color: #f2e5bc; +} +} + /* Resizer Preview */ div#resizer-preview { position: absolute; @@ -214,15 +233,8 @@ div.For.for-type-gpu_thread div.For.for-type-gpu_thread { padding: 0; } -b.Highlight { - font-weight: bold; - background-color: #DDD; -} - -span.Highlight { - font-weight: bold; - background-color: #FF0; -} +b.Highlight { font-weight: bold; background-color: #DDD; } +span.Highlight { font-weight: bold; background-color: #FF0; } b.HighlightToggle0 { font-weight: bold; background-color: oklch(80% 0.18 0); } b.HighlightToggle1 { font-weight: bold; background-color: oklch(80% 0.18 50); } @@ -232,6 +244,9 @@ b.HighlightToggle4 { font-weight: bold; background-color: oklch(80% 0.18 200); } b.HighlightToggle5 { font-weight: bold; background-color: oklch(80% 0.18 260); } b.HighlightToggle6 { font-weight: bold; background-color: oklch(80% 0.18 310); } @media (prefers-color-scheme: dark) { + b.Highlight { font-weight: bold; background-color: #7c6f64; color: #1d2021; } + span.Highlight { font-weight: bold; background-color: #e9b143; color: #1d2021; } + b.HighlightToggle0 { background-color: oklch(40% 0.18 0); } b.HighlightToggle1 { background-color: oklch(40% 0.18 50); } b.HighlightToggle2 { background-color: oklch(40% 0.18 100); } @@ -306,14 +321,11 @@ span.Memory { font-weight: bold; } -span.Pred { - background-color: #ffe8bd; - font-weight: bold; -} - -span.Label { - background-color: #bde4ff; - font-weight: bold; +span.Pred b { background-color: #ffe8bd; font-weight: bold !important; } +span.Label b { background-color: #bde4ff; font-weight: bold !important; } +@media (prefers-color-scheme: dark) { +span.Pred b { background-color: #d8a657; font-weight: bold !important; color: #076678; } +span.Label b { background-color: #a9b665; font-weight: bold !important; color: #076678; } } /* Collapse button and indent div logic */ @@ -332,6 +344,12 @@ input.show-hide-btn { transition: transform 0.2s; transform: rotate(0deg); } +@media (prefers-color-scheme: dark) { +input.show-hide-btn { + border: 1px solid #654735; + color: #e2cca9; +} +} input.show-hide-btn:checked { transform: rotate(-90deg); } @@ -395,6 +413,18 @@ input.show-hide-btn:hover + label + div.op-btns + div.indent + span.ClosingBrace left: -18px; content: " "; } +@media (prefers-color-scheme: dark) { +input.show-hide-btn:hover { + color: #f30000; +} +input.show-hide-btn:hover + label + div.op-btns + div.indent { + border-left: 2px dotted #e2cca9; +} +input.show-hide-btn:hover + label + div.op-btns + div.indent + span.ClosingBrace:after { + border-bottom: 2px dotted #e2cca9; + border-left: 2px dotted #e2cca9; +} +} input.show-hide-btn:checked + label + div.op-btns + div.indent { opacity: 0; @@ -470,59 +500,33 @@ div.code.ptx { tab-size: 26; } -span.comment { - color: #998; - font-style: italic; -} - -span.keyword { - color: #333; - font-weight: bold; -} - -span.IntImm { - color: #099; -} - -span.UIntImm { - color: #099; -} - -span.FloatImm { - color: #099; -} - -span.StringImm { - color: #d14; -} - -span.Type { - color: #445588; - font-weight: bold; -} - -span.Symbol { - color: #990073; -} - -span.Assign { - color: #d14; - font-weight: bold; -} - -div.WrapLine { - margin-left: 30px; - text-indent: -30px; +/* Syntax highlighting */ +span.comment { color: #998; font-style: italic; } +span.keyword { color: #333; font-weight: bold; } +span.IntImm { color: #099; } +span.UIntImm { color: #099; } +span.FloatImm { color: #099; } +span.StringImm { color: #d14; } +span.Type { color: #445588; font-weight: bold; } +span.Symbol { color: #990073; } +span.Assign { color: #d14; font-weight: bold; } +span.Comment { color: green; font-style: italic; } +@media (prefers-color-scheme: dark) { +span.comment { color: #a9b665; font-style: italic; } +span.keyword { color: #ea6962; font-weight: bold; } +span.IntImm { color: #89b482; } +span.UIntImm { color: #89b482; } +span.FloatImm { color: #89b482; } +span.StringImm { color: #e78a4e; } +span.Type { color: #7daea3; font-weight: bold; } +span.Symbol { color: #d3869b; } +span.Assign { color: #af3a03; font-weight: bold; } +span.Comment { color: #a9b665; font-style: italic; } } -span.OpeningBrace { - margin-left: 0.3em; -} -span.Comment { - color: green; - font-style: italic; -} +div.WrapLine { margin-left: 30px; text-indent: -30px; } +span.OpeningBrace { margin-left: 0.3em; } span.IfSpan, span.ClosingBrace, @@ -614,6 +618,13 @@ div.cost-btn:hover { cursor: pointer; /*border: 1px solid lightgray;*/ } +@media (prefers-color-scheme: dark ) { +div.cost-btn { + outline: 1px solid rgba(255,255,255,0.15); +} +} +/* Color theme light */ +@media (prefers-color-scheme: light ) { .block-CostColor0:first-child { border-left: 8px solid oklch(90.0% 0.05 140); } .block-CostColor1:first-child { border-left: 8px solid oklch(87.4% 0.06 140); } @@ -658,6 +669,7 @@ div.cost-btn:hover { .line-CostColor18:first-child { border-right: 8px solid oklch(42.6% 0.14 140); } .line-CostColor19:first-child { border-right: 8px solid oklch(40.0% 0.15 140); } .line-CostColorNone:first-child { border-right: transparent; } + .block-CostColor0:last-child { border-left: 8px solid oklch(90.0% 0.05 300); } .block-CostColor1:last-child { border-left: 8px solid oklch(87.4% 0.06 300); } .block-CostColor2:last-child { border-left: 8px solid oklch(84.7% 0.06 300); } @@ -702,6 +714,101 @@ div.cost-btn:hover { .line-CostColor19:last-child { border-right: 8px solid oklch(40.0% 0.15 300); } .line-CostColorNone:last-child { border-right: transparent; } +} /* End of light theme. */ + +/* Color theme dark */ +@media (prefers-color-scheme: dark ) { + +.block-CostColor0:first-child { border-left: 8px solid oklch(63.0% 0.05 140); } +.block-CostColor1:first-child { border-left: 8px solid oklch(61.2% 0.06 140); } +.block-CostColor2:first-child { border-left: 8px solid oklch(59.3% 0.06 140); } +.block-CostColor3:first-child { border-left: 8px solid oklch(57.5% 0.07 140); } +.block-CostColor4:first-child { border-left: 8px solid oklch(55.6% 0.07 140); } +.block-CostColor5:first-child { border-left: 8px solid oklch(53.8% 0.08 140); } +.block-CostColor6:first-child { border-left: 8px solid oklch(51.9% 0.08 140); } +.block-CostColor7:first-child { border-left: 8px solid oklch(50.1% 0.09 140); } +.block-CostColor8:first-child { border-left: 8px solid oklch(48.3% 0.09 140); } +.block-CostColor9:first-child { border-left: 8px solid oklch(46.4% 0.10 140); } +.block-CostColor10:first-child { border-left: 8px solid oklch(44.6% 0.10 140); } +.block-CostColor11:first-child { border-left: 8px solid oklch(42.7% 0.11 140); } +.block-CostColor12:first-child { border-left: 8px solid oklch(40.9% 0.11 140); } +.block-CostColor13:first-child { border-left: 8px solid oklch(39.1% 0.12 140); } +.block-CostColor14:first-child { border-left: 8px solid oklch(37.2% 0.12 140); } +.block-CostColor15:first-child { border-left: 8px solid oklch(35.4% 0.13 140); } +.block-CostColor16:first-child { border-left: 8px solid oklch(33.5% 0.13 140); } +.block-CostColor17:first-child { border-left: 8px solid oklch(31.7% 0.14 140); } +.block-CostColor18:first-child { border-left: 8px solid oklch(29.8% 0.14 140); } +.block-CostColor19:first-child { border-left: 8px solid oklch(28.0% 0.15 140); } +.block-CostColorNone:first-child { border-left: transparent; } + +.line-CostColor0:first-child { border-right: 8px solid oklch(63.0% 0.05 140); } +.line-CostColor1:first-child { border-right: 8px solid oklch(61.2% 0.06 140); } +.line-CostColor2:first-child { border-right: 8px solid oklch(59.3% 0.06 140); } +.line-CostColor3:first-child { border-right: 8px solid oklch(57.5% 0.07 140); } +.line-CostColor4:first-child { border-right: 8px solid oklch(55.6% 0.07 140); } +.line-CostColor5:first-child { border-right: 8px solid oklch(53.8% 0.08 140); } +.line-CostColor6:first-child { border-right: 8px solid oklch(51.9% 0.08 140); } +.line-CostColor7:first-child { border-right: 8px solid oklch(50.1% 0.09 140); } +.line-CostColor8:first-child { border-right: 8px solid oklch(48.3% 0.09 140); } +.line-CostColor9:first-child { border-right: 8px solid oklch(46.4% 0.10 140); } +.line-CostColor10:first-child { border-right: 8px solid oklch(44.6% 0.10 140); } +.line-CostColor11:first-child { border-right: 8px solid oklch(42.7% 0.11 140); } +.line-CostColor12:first-child { border-right: 8px solid oklch(40.9% 0.11 140); } +.line-CostColor13:first-child { border-right: 8px solid oklch(39.1% 0.12 140); } +.line-CostColor14:first-child { border-right: 8px solid oklch(37.2% 0.12 140); } +.line-CostColor15:first-child { border-right: 8px solid oklch(35.4% 0.13 140); } +.line-CostColor16:first-child { border-right: 8px solid oklch(33.5% 0.13 140); } +.line-CostColor17:first-child { border-right: 8px solid oklch(31.7% 0.14 140); } +.line-CostColor18:first-child { border-right: 8px solid oklch(29.8% 0.14 140); } +.line-CostColor19:first-child { border-right: 8px solid oklch(28.0% 0.15 140); } +.line-CostColorNone:first-child { border-right: transparent; } + +.block-CostColor0:last-child { border-left: 8px solid oklch(63.0% 0.05 300); } +.block-CostColor1:last-child { border-left: 8px solid oklch(61.2% 0.06 300); } +.block-CostColor2:last-child { border-left: 8px solid oklch(59.3% 0.06 300); } +.block-CostColor3:last-child { border-left: 8px solid oklch(57.5% 0.07 300); } +.block-CostColor4:last-child { border-left: 8px solid oklch(55.6% 0.07 300); } +.block-CostColor5:last-child { border-left: 8px solid oklch(53.8% 0.08 300); } +.block-CostColor6:last-child { border-left: 8px solid oklch(51.9% 0.08 300); } +.block-CostColor7:last-child { border-left: 8px solid oklch(50.1% 0.09 300); } +.block-CostColor8:last-child { border-left: 8px solid oklch(48.3% 0.09 300); } +.block-CostColor9:last-child { border-left: 8px solid oklch(46.4% 0.10 300); } +.block-CostColor10:last-child { border-left: 8px solid oklch(44.6% 0.10 300); } +.block-CostColor11:last-child { border-left: 8px solid oklch(42.7% 0.11 300); } +.block-CostColor12:last-child { border-left: 8px solid oklch(40.9% 0.11 300); } +.block-CostColor13:last-child { border-left: 8px solid oklch(39.1% 0.12 300); } +.block-CostColor14:last-child { border-left: 8px solid oklch(37.2% 0.12 300); } +.block-CostColor15:last-child { border-left: 8px solid oklch(35.4% 0.13 300); } +.block-CostColor16:last-child { border-left: 8px solid oklch(33.5% 0.13 300); } +.block-CostColor17:last-child { border-left: 8px solid oklch(31.7% 0.14 300); } +.block-CostColor18:last-child { border-left: 8px solid oklch(29.8% 0.14 300); } +.block-CostColor19:last-child { border-left: 8px solid oklch(28.0% 0.15 300); } +.block-CostColorNone:last-child { border-left: transparent; } + +.line-CostColor0:last-child { border-right: 8px solid oklch(63.0% 0.05 300); } +.line-CostColor1:last-child { border-right: 8px solid oklch(61.2% 0.06 300); } +.line-CostColor2:last-child { border-right: 8px solid oklch(59.3% 0.06 300); } +.line-CostColor3:last-child { border-right: 8px solid oklch(57.5% 0.07 300); } +.line-CostColor4:last-child { border-right: 8px solid oklch(55.6% 0.07 300); } +.line-CostColor5:last-child { border-right: 8px solid oklch(53.8% 0.08 300); } +.line-CostColor6:last-child { border-right: 8px solid oklch(51.9% 0.08 300); } +.line-CostColor7:last-child { border-right: 8px solid oklch(50.1% 0.09 300); } +.line-CostColor8:last-child { border-right: 8px solid oklch(48.3% 0.09 300); } +.line-CostColor9:last-child { border-right: 8px solid oklch(46.4% 0.10 300); } +.line-CostColor10:last-child { border-right: 8px solid oklch(44.6% 0.10 300); } +.line-CostColor11:last-child { border-right: 8px solid oklch(42.7% 0.11 300); } +.line-CostColor12:last-child { border-right: 8px solid oklch(40.9% 0.11 300); } +.line-CostColor13:last-child { border-right: 8px solid oklch(39.1% 0.12 300); } +.line-CostColor14:last-child { border-right: 8px solid oklch(37.2% 0.12 300); } +.line-CostColor15:last-child { border-right: 8px solid oklch(35.4% 0.13 300); } +.line-CostColor16:last-child { border-right: 8px solid oklch(33.5% 0.13 300); } +.line-CostColor17:last-child { border-right: 8px solid oklch(31.7% 0.14 300); } +.line-CostColor18:last-child { border-right: 8px solid oklch(29.8% 0.14 300); } +.line-CostColor19:last-child { border-right: 8px solid oklch(28.0% 0.15 300); } +.line-CostColorNone:last-child { border-right: transparent; } + +} /* End of dark theme. */ + .NoChildCost { border-left: none !important; } @@ -712,7 +819,6 @@ div.cost-btn:hover { */ [class*=shj-lang-]{ white-space:pre; - background:white; color:#112; box-shadow:0 0 5px #0001; text-shadow:none; @@ -770,7 +876,7 @@ div.cost-btn:hover { color:#999 } .shj-syn-insert,.shj-syn-str{ - color:#7d8 + color:#496 } .shj-syn-bool{ color:#3bf @@ -806,3 +912,27 @@ div.cost-btn:hover { margin-bottom:20px } + +@media (prefers-color-scheme: dark) { +[class*="shj-lang-"] { + background-color: #141617; + color: #d4be98; +} +[class*="shj-lang-"]:before {color: #6f9aff} + +.shj-syn-insert {color: #98c379} +.shj-syn-deleted, +.shj-syn-err, +.shj-syn-kwd {color: #ea6962} +.shj-syn-class {color: #ffa657} +.shj-numbers, +.shj-syn-cmnt {color: #8b949e} +.shj-syn-type, +.shj-syn-oper, +.shj-syn-num, +.shj-syn-section, +.shj-syn-var, +.shj-syn-bool {color: #7daea3} +.shj-syn-str {color: #e78a4e} +.shj-syn-func {color: #d2a8ff} +} diff --git a/src/irvisualizer/html_template_StmtToHTML_dependencies.html b/src/irvisualizer/html_template_StmtToHTML_dependencies.html index 9fe9477e8fe2..76f58aeb3633 100644 --- a/src/irvisualizer/html_template_StmtToHTML_dependencies.html +++ b/src/irvisualizer/html_template_StmtToHTML_dependencies.html @@ -1,11 +1,64 @@ - - - From 03f79ac62be08c5aa9bb6c7edb01308bf05c3ff2 Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Thu, 27 Jun 2024 14:24:39 +0200 Subject: [PATCH 3/4] Toolbar for HTML Stmt viewer with various settings. --- python_bindings/src/halide/halide_/PyFunc.cpp | 5 + .../src/halide/halide_/PyPipeline.cpp | 5 + src/StmtToHTML.cpp | 34 + src/irvisualizer/generate_palettes.py | 59 +- src/irvisualizer/html_template_StmtToHTML.css | 873 +++++++++--------- src/irvisualizer/html_template_StmtToHTML.js | 74 +- ...html_template_StmtToHTML_dependencies.html | 21 +- 7 files changed, 618 insertions(+), 453 deletions(-) diff --git a/python_bindings/src/halide/halide_/PyFunc.cpp b/python_bindings/src/halide/halide_/PyFunc.cpp index bcc889b6d9ce..495187581aaa 100644 --- a/python_bindings/src/halide/halide_/PyFunc.cpp +++ b/python_bindings/src/halide/halide_/PyFunc.cpp @@ -287,6 +287,11 @@ void define_func(py::module &m) { f.compile_to_lowered_stmt(filename, args, fmt, to_aot_target(target)); }, py::arg("filename"), py::arg("arguments"), py::arg("fmt") = Text, py::arg("target") = Target()) + .def( + "compile_to_conceptual_stmt", [](Func &f, const std::string &filename, const std::vector &args, StmtOutputFormat fmt, const Target &target) { + f.compile_to_conceptual_stmt(filename, args, fmt, to_aot_target(target)); + }, + py::arg("filename"), py::arg("arguments"), py::arg("fmt") = Text, py::arg("target") = Target()) .def( "compile_to_file", [](Func &f, const std::string &filename_prefix, const std::vector &args, const std::string &fn_name, const Target &target) { f.compile_to_file(filename_prefix, args, fn_name, to_aot_target(target)); diff --git a/python_bindings/src/halide/halide_/PyPipeline.cpp b/python_bindings/src/halide/halide_/PyPipeline.cpp index a87ffcedf39d..aeac06fe8092 100644 --- a/python_bindings/src/halide/halide_/PyPipeline.cpp +++ b/python_bindings/src/halide/halide_/PyPipeline.cpp @@ -139,6 +139,11 @@ void define_pipeline(py::module &m) { p.compile_to_lowered_stmt(filename, args, fmt, to_aot_target(target)); }, py::arg("filename"), py::arg("arguments"), py::arg("fmt") = Text, py::arg("target") = Target()) + .def( + "compile_to_conceptual_stmt", [](Pipeline &p, const std::string &filename, const std::vector &args, StmtOutputFormat fmt, const Target &target) { + p.compile_to_conceptual_stmt(filename, args, fmt, to_aot_target(target)); + }, + py::arg("filename"), py::arg("arguments"), py::arg("fmt") = Text, py::arg("target") = Target()) .def( "compile_to_file", [](Pipeline &p, const std::string &filename_prefix, const std::vector &args, const std::string &fn_name, const Target &target) { p.compile_to_file(filename_prefix, args, fn_name, to_aot_target(target)); diff --git a/src/StmtToHTML.cpp b/src/StmtToHTML.cpp index 79cf6563551e..0811f38175de 100644 --- a/src/StmtToHTML.cpp +++ b/src/StmtToHTML.cpp @@ -2378,7 +2378,10 @@ class PipelineHTMLInspector { void generate_body(const Module &m) { stream << "\n"; stream << "
\n"; + generate_toolbar(m); + stream << "
\n"; generate_visualization_panes(m); + stream << "
\n"; stream << "
\n"; #if INLINE_TEMPLATES stream << " From a42648eebb6ed9765f11258103927bc0d2604188 Mon Sep 17 00:00:00 2001 From: Martijn Courteaux Date: Thu, 27 Jun 2024 14:25:55 +0200 Subject: [PATCH 4/4] Cleanup. --- src/irvisualizer/html_template_StmtToHTML.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/irvisualizer/html_template_StmtToHTML.js b/src/irvisualizer/html_template_StmtToHTML.js index ce4cbc297519..ab92c4aa878e 100644 --- a/src/irvisualizer/html_template_StmtToHTML.js +++ b/src/irvisualizer/html_template_StmtToHTML.js @@ -207,10 +207,6 @@ function scrollToDeviceCode(lno) { // eslint-disable-line no-unused-vars } } -function setTheme(theme) { - console.log(theme); -} - function initToolbar() { /* IR Settings */