File size: 1,454 Bytes
3d11fac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # tiny_prefill_decode_npir
Tiny autoregressive prefill/decode NPIR fixture for multi-graph GQ tests (NPP02-7270). KV cache is graph I/O (not an internal stateful buffer), matching the `USER_INPUT`/`USER_OUTPUT`/`USER_INPUT_MUTATION` form measured on a real `smollm2` `torch.export` `graph_signature`. Deterministic (seed 0), 2 layers, reduced dims.
- prefill/: input_ids [1, 4] -> logits [1, 4, 16] + 2 K/V pairs [1, 1, 8, 8]
- decode/: input_ids [1, 1], position_ids [1, 1], 2 K/V pairs (same shape) -> logits [1, 1, 16] + the same K/V pairs, updated in place
Composition edges (one per K/V tensor, `[k0, v0, k1, v1, ...]` order):
- `prefill.index_copy_.output_0` -> `decode.k0`
- `prefill.index_copy__1.output_0` -> `decode.v0`
- `prefill.index_copy__2.output_0` -> `decode.k1`
- `prefill.index_copy__3.output_0` -> `decode.v1`
No `decode -> decode` edge is declared: the autoregressive feedback (decode's own K/V output feeding its next-step input) is a cycle and is correctly rejected by `multi_graph.composition.topological_order` (`CyclicCompositionError`) -- it is runtime/wiring's concern, not GQ's calibration DAG.
Calibration payload gotcha: decode's two non-edge inputs (`input_ids`, `position_ids`) need a `PT`-format payload (`torch.save`d `dict[str, list[torch.Tensor]]`) whose per-sample tensors already carry their own batch dimension (e.g. shape `[1, 1]`, not `[1]`) -- unlike `NPY`, the `PT` loader does not add a batch dimension.
|