mirror of https://github.com/commaai/tinygrad.git
viz print the sink tree as it's rewritten [pr] (#7094)
This commit is contained in:
parent
aadc95c2b0
commit
56fbd408a1
|
@ -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("<", "<").replaceAll(">", ">");
|
||||
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("<", "<").replaceAll(">", ">");
|
||||
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" })
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue