Skip to content

Line-buffered chains: compiler flag, serialization, and differential gate - #28

Merged
asteinh merged 2 commits into
developfrom
feature/linebuffer-chains
Aug 15, 2026
Merged

Line-buffered chains: compiler flag, serialization, and differential gate#28
asteinh merged 2 commits into
developfrom
feature/linebuffer-chains

Conversation

@asteinh

@asteinh asteinh commented Aug 15, 2026

Copy link
Copy Markdown
Member

Summary

Compiler support for line-buffered chains, plus a deterministic cross-repo gate
that proves the optimization is correct and measures its effect. When a chain
recomputes its inter-tile overlap (composed halo greater than the stride), the
compiler now marks the chain head so the runtime can roll the overlap rows
across tiles instead of recomputing them.

Pairs with the runtime change in raws-labs/tigris-runtime#30, which performs the
roll and keeps output bit-exact.

What changed

  • detect_and_solve_chains marks a recomputing chain head with a
    line-buffered flag, computed from the composed effective kernel height and
    stride across the chain's spatial ops.
  • The binary emitter serializes the flag in the head stage's reserved field.
    The stage struct layout is unchanged (the flag reuses spare bits), so the
    plan schema and existing plans are unaffected.
  • New crossrepo_contract.py cases compile a chained model at a tight budget
    so it is line-buffered, run it through the runtime, and assert byte-level
    parity against ONNX Runtime for float and int8. The model height forces a
    partial last tile so tile 0, interior, and last-partial paths all run. A
    recompute-reduction case runs the same plan with and without the line buffer
    and asserts the kernel-row count drops.

Testing

  • pytest: full suite passes (304 passed, 2 skipped).
  • Cross-repo gate: all existing memory-contract cases pass, and the two new
    line-buffered cases (float and int8) are bit-exact against ONNX Runtime with a
    measured recompute reduction of 1.562x (203 kernel rows versus 317) over 22
    tiles with a partial last tile.

@asteinh
asteinh merged commit 6a4fc59 into develop Aug 15, 2026
10 checks passed
@asteinh
asteinh deleted the feature/linebuffer-chains branch August 15, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant