mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
sqtt: show total cycles of kernel in viz (#13169)
This commit is contained in:
parent
2ba8b4946f
commit
8a7fa9e7b4
2 changed files with 4 additions and 3 deletions
|
|
@ -716,8 +716,8 @@ async function main() {
|
|||
}
|
||||
}
|
||||
metadata.appendChild(tabulate(ret.summary.map(s => {
|
||||
const div = d3.create("div").style("background", cycleColors(colorScheme.CATEGORICAL, s.idx)).style("width", "24px").style("height", "100%");
|
||||
return [s.label.trim(), div.node()];
|
||||
const div = d3.create("div").style("background", cycleColors(colorScheme.CATEGORICAL, s.idx)).style("width", "100%").style("height", "100%");
|
||||
return [s.label.trim(), div.text(s.value.toLocaleString()).node()];
|
||||
})).node());
|
||||
} else root.appendChild(codeBlock(ret.src, ret.lang || "txt"));
|
||||
return document.querySelector("#custom").replaceChildren(root);
|
||||
|
|
|
|||
|
|
@ -206,9 +206,10 @@ def load_sqtt(profile:list[ProfileEvent]) -> None:
|
|||
except Exception: return err("DECODER IMPORT ISSUE")
|
||||
try:
|
||||
rctx = decode(profile)
|
||||
summary = [[{"label":"Total Cycles", "value":x[-1].time-x[0].time if x else 0}] for i,x in enumerate(rctx.inst_execs.values())]
|
||||
steps = [{"name":str(x[0]), "depth":0, "data":{"rows":[(e.inst, e.time, e.time-x[1][i-1].time if i else 0, e.dur, e.stall,
|
||||
str(e.typ).split("_")[-1]) for i,e in enumerate(x[1])],
|
||||
"cols":["Instruction", "Clk", "Wait", "Duration", "Stall", "Type"], "summary":[]},
|
||||
"cols":["Instruction", "Clk", "Wait", "Duration", "Stall", "Type"], "summary":summary[i]},
|
||||
"query":f"/render?ctx={len(ctxs)}&step={i}&fmt=counters"} for i,x in enumerate(rctx.inst_execs.items())]
|
||||
if not steps: return err("EMPTY SQTT OUTPUT", f"{len(sqtt_events)} SQTT events recorded, none got decoded")
|
||||
except Exception: return err("DECODER ERROR")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue