Fix sliding-window chunked prefill in the gemma4-31B runner#20346
Open
digantdesai wants to merge 2 commits into
Open
Fix sliding-window chunked prefill in the gemma4-31B runner#20346digantdesai wants to merge 2 commits into
digantdesai wants to merge 2 commits into
Conversation
Contributor
Author
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20346
Note: Links to docs will display an error until the docs builds have been completed. ❗ 2 Active SEVsThere are 2 currently active SEVs. If your PR is affected, please view them below:
❌ 1 New Failure, 1 Unrelated Failure, 2 Unclassified FailuresAs of commit 6415edb with merge base da9158b ( NEW FAILURE - The following job has failed:
UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Jun 17, 2026
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.
The runner chunked prefill at get_max_prefill_chunk = 2sliding_window (2048).
A chunk larger than the window overflows the 2window ring KV cache across
chunk boundaries: after writing a 2048-token chunk the ring holds only the most
recent 2048 positions, so the first ~(chunk - window) queries of every chunk
after the first lose the tail of the previous chunk that is still inside their
1024 window. Those sliding-layer queries then attend over a truncated window,
which propagates into their hidden states and the global KV those positions
write, changing the output. The global flat-cache layers are unaffected.
Cap the prefill chunk at the sliding window: get_sliding_window from metadata
(now exported), else max_prefill/2 since the export sets max_prefill =
2*sliding_window. Decode is unaffected. Adds --max_prefill_chunk to override
the chunk size for testing.
Authored with assistance from Claude Code.