Skip to content

Support PP->TP resharding for token-major KV cache layout - #1139

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_991894537
Oct 2, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_991894537

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Support PP->TP resharding for token-major KV cache layout

Currently, the pool reshard planner takes only plain contiguous byte ranges. However, with a token-major KV page (tokens, then heads), a tensor-parallel decode's share of a pipeline-parallel prefill's page is one head slice per token, which is a strided range, so PP->TP transfers are rejected at planning.

This PR fixes that by:

accepting a strided span that lies inside one destination page;
sending it as one strided entry per destination rank instead of one entry per token, when both pools store a block as one contiguous region;
raising the receiver's repeat bound from 2^20 to 2^24, enough for a 32K-token request.
Used by sgl-project/sglang-torchtpu#748 (PP8 prefill to TP8 decode).

@copybara-service copybara-service Bot changed the title Plan head-sliced byte spans as strided entries for KV resharding. Support PP->TP resharding for token-major KV cache layout Oct 2, 2026
Currently, the pool reshard planner takes only plain contiguous byte ranges. However, with a token-major KV page (tokens, then heads), a tensor-parallel decode's share of a pipeline-parallel prefill's page is one head slice per token, which is a strided range, so PP->TP transfers are rejected at planning.

This PR fixes that by:

accepting a strided span that lies inside one destination page;
sending it as one strided entry per destination rank instead of one entry per token, when both pools store a block as one contiguous region;
raising the receiver's repeat bound from 2^20 to 2^24, enough for a 32K-token request.
Used by sgl-project/sglang-torchtpu#748 (PP8 prefill to TP8 decode).

PiperOrigin-RevId: 992103162
@copybara-service
copybara-service Bot merged commit 120bab9 into main Oct 2, 2026
2 checks passed
@copybara-service
copybara-service Bot deleted the test_991894537 branch October 2, 2026 05:03
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