JS-replay trace (DG_TRACE_JS=<outdir>) #
Dumps everything a thin JS+WebGPU replayer needs to re-execute a decode step of the DiffusionGemma engine (the Campaign-3 trace-replay pattern, aimed at Chrome instead of Metal):
k<hash>.wgsl— every template-expanded kernel, written once at first pipeline compile (per-process pipeline cache guarantees the source is in hand exactly then).ops.jsonl— the event stream while ARMED: {"t":"d","k":H,"n":name,"g":[x,y,z],"b":[[bufName,uid],…]} dispatch {"t":"w","u":uid,"o":off,"s":size,"hex":"…"?} writeBuffer {"t":"r","u":uid,"o":off,"s":size} readback {"t":"f"} queue flush {"t":"m","tag":str} markerbuffers.json— uid → byte size for every buffer created while enabled.tensors.json— uid → GGUF tensor name (weight provenance: the JS side loads the GGUF itself and uploads each tensor into its replay slot).
Buffer identity = getBufferId (the raw WGPUBuffer handle), already used by
the bind-group cache. Write contents are recorded as hex for writes ≤ 64 KB
(params, canvases, norms); larger writes (weights) are size-only — their
provenance comes from tensors.json.
Equations
- Hesper.WGSL.JSTrace.enabled = do let __do_lift ← ST.Ref.get Hesper.WGSL.JSTrace.dirRef pure __do_lift.isSome
Instances For
Equations
- Hesper.WGSL.JSTrace.arm = do let __do_lift ← Hesper.WGSL.JSTrace.enabled if __do_lift = true then ST.Ref.set Hesper.WGSL.JSTrace.armedRef true else pure PUnit.unit
Instances For
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
record a kernel's WGSL at first compile (independent of arming: the pipeline cache means compile happens once, possibly before the traced step).
Equations
- One or more equations did not get rendered due to their size.
Instances For
readback event; contents ≤ 2MB are recorded so a replayer can gate on bit-equality without porting the CPU logic that consumes them.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Hesper.WGSL.JSTrace.flush = Hesper.WGSL.JSTrace.emit "{\"t\":\"f\"}"
Instances For
Equations
- Hesper.WGSL.JSTrace.mark tag = Hesper.WGSL.JSTrace.emit (toString "{\"t\":\"m\",\"tag\":\"" ++ toString tag ++ toString "\"}")
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
FNV-1a 32-bit over the first n bytes (mirrored by the JS replayer).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
drop accumulated ops (used between the ref-collection step and the recorded replay step).
Instances For
uids referenced by traced dispatches that have NEITHER GGUF tensor provenance NOR recorded write contents — the derived buffers a replayer must load from .bin dumps.
Equations
- Hesper.WGSL.JSTrace.missingUids = do let refs ← ST.Ref.get Hesper.WGSL.JSTrace.refUidsRef pure (Array.map (fun (x : UInt64 × Bool) => x.fst) refs.toList.toArray)
Instances For
Equations
- Hesper.WGSL.JSTrace.untraced = do let __do_lift ← Hesper.WGSL.JSTrace.armed if __do_lift = true then ST.Ref.modify Hesper.WGSL.JSTrace.untracedRef fun (x : Nat) => x + 1 else pure PUnit.unit
Instances For
write ops.jsonl / buffers.json / tensors.json and report.
Equations
- One or more equations did not get rendered due to their size.