fix(qwen): dispatch decode with runtime batch - #202
Open
Little-oil wants to merge 1 commit into
Open
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Little-oil
force-pushed
the
test-pypto-pa
branch
3 times, most recently
from
August 27, 2026 06:50
5d675e6 to
b352ca0
Compare
Little-oil
pushed a commit
to Little-oil/pypto-serving
that referenced
this pull request
Aug 27, 2026
Point the submodule at merged pypto-lib PR #1031 revision da91587.
Little-oil
force-pushed
the
test-pypto-pa
branch
from
August 31, 2026 06:38
c5c8257 to
c4981b4
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.
Summary
pypto-libsubmodule to Add: use PyPTO paged attention in Qwen3 decode pypto-lib#1031Root cause
The Qwen runner treated decode as fixed-batch. When chunked prefill produced a partial decode batch, it copied row 0's token, sequence length, block table, and slot mapping into every inactive row and launched all max-batch rows.
The decode ABI is runtime-batch dynamic. With native paged attention, each row appends K/V in parallel, so the replicated rows made several lanes write the same physical KV slot concurrently. Under a B16, 3338-token long-context workload this could silently produce all-zero output streams.
This change retains max-batch storage but narrows every batch-shaped dispatch argument to
actual_batch, including worker-residentDeviceTensorlogits and next-hidden buffers used by device sampling.Fixes #201
Validation
python -m pytest -q tests/unit/model/qwen: 31 passedgit diff --check: passedNPU long-context regression (a2a3):
Qwen performance comparison
PA is fused into the all-layer
decode_fwd, so the serving trace does not expose a representative standalone PA event. The comparison therefore reports directly measured fused-Qwen and end-to-end durations rather than derived PA throughput.decode_fwdmeandecode_fwdmeanNegative delta means the PyPTO version completed faster. Across the two paired cards, the mean duration changed by approximately -0.24% for fused
decode_fwdand -0.40% for the full Qwen generation window, which is performance parity.Dependency
This PR points the submodule at the merged hw-native-sys/pypto-lib#1031 commit
da91587.Scope
The current CI run passes both Qwen3 guards. Its only failure is the later DeepSeek V4 MTP stage: the pre-existing DeepSeek HC head uses
pl.create_tensor(..., init_value=0), which current PyPTO no longer supports. That line is identical at the base and updated pypto-lib revisions, and this branch contains no DeepSeek source changes.