Line-buffered chains: compiler flag, serialization, and differential gate - #28
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_chainsmarks a recomputing chain head with aline-buffered flag, computed from the composed effective kernel height and
stride across the chain's spatial ops.
The stage struct layout is unchanged (the flag reuses spare bits), so the
plan schema and existing plans are unaffected.
crossrepo_contract.pycases compile a chained model at a tight budgetso 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
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.