diff --git a/tinygrad/viz/js/index.js b/tinygrad/viz/js/index.js index bf83e3e4c6..74f3e1d5e5 100644 --- a/tinygrad/viz/js/index.js +++ b/tinygrad/viz/js/index.js @@ -198,6 +198,8 @@ function focusShape(shape) { return metadata.replaceChildren(shapeMetadata.get(focusedShape) ?? ""); } +const EventTypes = { EXEC:0, BUF:1 }; + async function renderProfiler(path, unit) { displaySelection("#profiler"); metadata.replaceChildren(shapeMetadata.get(focusedShape) ?? ""); @@ -238,12 +240,11 @@ async function renderProfiler(path, unit) { const { y:baseY, height:baseHeight } = rect(div.node()); const offsetY = baseY-canvasTop+padding/2; const shapes = [], visible = []; - const EventTypes = {TIMELINE:0, MEMORY:1}; const eventType = u8(), eventsLen = u32(); - if (eventType === EventTypes.TIMELINE) { + if (eventType === EventTypes.EXEC) { const levelHeight = baseHeight-padding; const levels = []; - data.tracks.set(k, { shapes, visible, offsetY, pcolor:"#9ea2ad" }); + data.tracks.set(k, { shapes, eventType, visible, offsetY, pcolor:"#9ea2ad" }); let colorKey, ref; for (let j=0; j { const newFocus = e.currentTarget.id === focusedDevice ? null : e.currentTarget.id; let offset = 0; @@ -396,11 +398,11 @@ async function renderProfiler(path, unit) { xscale.domain(visibleX); // draw shapes const paths = []; - for (const [_, { offsetY, shapes, visible, valueMap, pcolor }] of data.tracks) { + for (const [_, { shapes, eventType, visible, offsetY, valueMap, pcolor }] of data.tracks) { visible.length = 0; for (const e of shapes) { const p = new Path2D(); - if (e.width == null) { // generic polygon + if (eventType === EventTypes.BUF) { // generic polygon if (e.x[0]>et || e.x.at(-1)