[DRAFT] Allocate host staging per transfer instead of fixed slots - #722
Draft
yinlin09 wants to merge 2 commits into
Draft
[DRAFT] Allocate host staging per transfer instead of fixed slots#722yinlin09 wants to merge 2 commits into
yinlin09 wants to merge 2 commits into
Conversation
Host staging was carved into fixed slots of max_blocks pages each, and a read borrowed a whole slot however few pages it needed. Sizing the slot for the longest request a server accepts therefore left most of every slot idle on a short one, and capped concurrent transfers at the slot count rather than at what the pool could actually hold. Under TPU_RAIDEN_DYNAMIC_HOST_STAGING=1 a read instead allocates exactly the pages it stages and hands them back on completion, so the same pool seats transfers in proportion to their size. The copy plan already addressed host blocks explicitly, so nothing downstream changes. Off by default. The producer push path and the pool-plan receive path still use fixed slots.
The producer side of a served pull borrowed a fixed staging slot per transfer, so the slot count capped concurrent serves, and an exhausted pool marked the send done without transferring anything -- the consumer then waited out its full timeout before failing. Under demand staging the serve allocates exactly the pages it stages, and either mode now waits for staging to free (bounded by the transfer deadline) instead of fabricating completion. A request that can never fit, or one still unseated at the deadline, is reported as a transfer failure so the consumer aborts promptly with a reason. Completion, ack, and error paths hand demand-staged blocks back through the same release helper that returned fixed slots.
yinlin09
force-pushed
the
yinlin/dynamic-host-staging
branch
from
August 19, 2026 22:48
16da7c6 to
613b38b
Compare
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.
What
Allocates host staging per transfer instead of carving the pool into fixed
slots, behind
TPU_RAIDEN_DYNAMIC_HOST_STAGING=1.Today the staging pool is pre-partitioned into
num_slotsslots ofmax_blocksblocks, and a transfer borrows a whole slot however few pages itneeds:
most of their slot;
(
StartRead) and the producer serving a pull (StartPushInternal);transferring, leaving the consumer to burn its full timeout before failing.
How
Under the flag, both paths allocate exactly the pages they stage from the
existing host block manager (locked against LRU eviction for the transfer's
lifetime) and hand them back on completion, timeout, or error through the same
release helpers that returned fixed slots. The copy plans already address host
blocks explicitly, so nothing downstream changes and nothing changes on the
wire.
Exhaustion behaviour changes in both modes: the producer now waits for staging
to free (bounded by the transfer deadline) instead of fabricating completion,
and a request that can never fit is reported as a transfer failure with a
reason.
Off by default; the fixed-slot layout is untouched without the flag. The
reshard/pool-plan paths are unchanged.
Status — draft
Both wheel legs build green through
ci/build_wheel.sh(jax and torch; thetorch wheel's three ABI extensions each carry the new code path). On-TPU
validation is in progress: a prefill/decode pair serving with the flag on, at
concurrency above what the fixed-slot layout could seat. Known follow-up:
a throughput comparison against the slot path at equal concurrency.