viz print the sink tree as it's rewritten [pr] (#7094)

This commit is contained in:
qazal 2024-10-16 11:38:27 +03:00 committed by GitHub
parent aadc95c2b0
commit 56fbd408a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -311,13 +311,16 @@
metadata.style.userSelect = "initial";
}
// ** code blocks
let code = ret.uops[currentRewrite];
let lang = "python"
if (ret.kernel_code != null) {
const code = ret.kernel_code.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
const pre = Object.assign(document.createElement("pre"), { innerHTML: `<code>${DOMPurify.sanitize(code)}</code>`,
className: "code-block language-cpp" });
hljs.highlightElement(pre);
metadata.appendChild(pre);
code = ret.kernel_code.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
lang = "cpp";
}
const codeBlock = Object.assign(document.createElement("pre"), { innerHTML: `<code>${DOMPurify.sanitize(code)}</code>`,
className: `code-block language-${lang}` });
hljs.highlightElement(codeBlock);
metadata.appendChild(codeBlock);
// ** rewrite list
if (ret.graphs.length > 1) {
const rewriteList = Object.assign(document.createElement("div"), { className: "rewrite-list" })

View File

@ -104,7 +104,7 @@ class Handler(BaseHTTPRequestHandler):
query = parse_qs(url.query)
if (qkernel:=query.get("kernel")) is not None:
g = get_details(*kernels[int(qkernel[0])][int(query["idx"][0])])
ret = json.dumps({**asdict(g), "graphs": list(map(uop_to_json, g.graphs))}).encode()
ret = json.dumps({**asdict(g), "graphs": list(map(uop_to_json, g.graphs)), "uops": list(map(str, g.graphs))}).encode()
else: ret = json.dumps([list(map(lambda x:asdict(x[2]), v)) for v in kernels]).encode()
else:
self.send_response(404)