Don't schedule prefill unless there is enough kv cache left to fulfil decode stage#5467
Open
AleksKnezevic wants to merge 3 commits into
Open
Don't schedule prefill unless there is enough kv cache left to fulfil decode stage#5467AleksKnezevic wants to merge 3 commits into
AleksKnezevic wants to merge 3 commits into
Conversation
kmabeeTT
approved these changes
Jun 30, 2026
kmabeeTT
left a comment
Contributor
There was a problem hiding this comment.
Awesome, looks good - this should help me replace the max_concurrency=32 -> 8 drop I had to make as a workaround in tt-inference-server to get Qwen3-8B running r1_gpqa_diamond eval to take 80 minutes instead of timeout for this effort (tenstorrent/tt-inference-server#4131 (comment))
mmanzoorTT
approved these changes
Jun 30, 2026
| # See TTConfig.prefill_kv_watermark. | ||
| if additional_config.get("prefill_kv_watermark") is None: | ||
| additional_config["prefill_kv_watermark"] = TTConfig.prefill_kv_watermark | ||
| env_wm = os.environ.get("TT_XLA_PREFILL_KV_WATERMARK_PERCENT") |
Contributor
There was a problem hiding this comment.
We are mostly using env variable as TTXLA_***
Suggested change
| env_wm = os.environ.get("TT_XLA_PREFILL_KV_WATERMARK_PERCENT") | |
| env_wm = os.environ.get("TTXLA_PREFILL_KV_WATERMARK_PERCENT") |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5467 +/- ##
==========================================
- Coverage 33.84% 33.82% -0.03%
==========================================
Files 37 37
Lines 4990 4990
==========================================
- Hits 1689 1688 -1
- Misses 3301 3302 +1 ☔ View full report in Codecov by Harness. |
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.
Ticket
Link to Github Issue
Problem description
When generating high OSL sequences if a prefill is scheduled with low KV cache availability, it will be serviced, then immediately discarded as there is not enough cache available to fulfill decode.
What's changed
Added minimal overhead, defaults to 25%, controllable by
TT_XLA_PREFILL_KV_WATERMARK_PERCENTChecklist