Expand description
Env-gated hidden-state trace, shared by the reference executor and the CUDA trunk.
MEMRA_HYPER_TRACE=<path> makes BOTH sides append the same stage names, in the same
format, from the same token ids — so a bisect compares like with like instead of two
hand-rolled dumps that agree on nothing but the layer index. It lives in the reference
crate because memra-engine already depends on it, so one emitter serves both.
Format (memra-hidden-trace-v1), one line per stage, the LAST token row only:
stage\t<name>\t<layer|-1>\t<width>\t<f32 bits hex>,<f32 bits hex>,...Only the last row is emitted: it is the row the logits come from, and it is the row every
banked oracle in this lane already pins. Width is streams * hidden at the residual-stream
stages and hidden at the branch stages.
Off by default and, when off, costs one OnceLock read per call — no allocation, no
device work, and no arm selection changes anywhere (unlike the MoE traces, which move
observation_mode). Turning it on cannot change what the model computes.
Functions§
- emit_
last_ row - Emit the last token row of a
[rows, width]row-major activation. - emit_
tokens - Record the run’s token ids once, so a trace file can be checked against its oracle TSV.
- enabled
- True when
MEMRA_HYPER_TRACEnamed a path. Callers use it to skip a device readback.