Repository navigation
fix(mla): plan persistent decode over the rows q/o have #2557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gbyu-amd
wants to merge
9
commits into
main
Choose a base branch
from
gyu/mla-persistent-plan-q-rows
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bd06445
fix(mla): plan persistent decode over the rows q/o have
gbyu-amd c323a0d
fix(mla): plan the sparse-MTP dense metadata over q's rows too
gbyu-amd a0f1bd0
docs(mla): shorten the persistent-plan comments
gbyu-amd 3e6d653
Merge branch 'main' into gyu/mla-persistent-plan-q-rows
gbyu-amd 8a24a91
Merge branch 'main' into gyu/mla-persistent-plan-q-rows
gbyu-amd 9234e3b
Merge branch 'main' into gyu/mla-persistent-plan-q-rows
gbyu-amd 652422e
fix(mla): plan persistent decode over the scheduled requests only
gbyu-amd 6f8cd33
docs(mla): shorten the scheduled-requests comment
gbyu-amd e7d400d
Merge branch 'main' into gyu/mla-persistent-plan-q-rows
gbyu-amd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -642,3 +642,21 @@ def test_shared_maps_skip_h2d_per_slot_and_tbo_buffer(monkeypatch, kind, transpo | |
| torch.cuda.synchronize() | ||
| for actual, expected in observed: | ||
| assert torch.equal(actual.cpu(), expected) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("q", [1, 3]) | ||
| def test_mla_persistent_plan_spans_only_rows_q_has(monkeypatch, q): | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is skipped unless |
||
| # running_bs is the group's batch either way; running_tokens is the | ||
| # group's height only on a DP-unified step, and this rank's own count | ||
| # while a peer is prefilling -- the height q and o are allocated at. | ||
| runner, builder = make_runner(monkeypatch, "mla", q=q, tbo=False) | ||
| planned = [] | ||
| builder.set_mla_persistent_worker_buffers = ( | ||
| lambda bs, *a, **kw: planned.append(bs) or {} | ||
| ) | ||
| for count, running_tokens in ((1, q), (2, 2 * q), (2, 4 * q), (4, 4 * q)): | ||
| batch = decode_batch(count, q) | ||
| start_decode(runner, builder, batch, q) | ||
| builder.prepare_decode(batch, 4, running_tokens, q) | ||
| finish(runner) | ||
| assert planned == [1, 2, 4, 4] | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This floors below
scheduled_bswhenever a sequence forwards fewer thanmax_seqlen_qrows, e.g. a DSpark q-bucket or ragged shrink under DP, wheremax_seqlen_qis the group max. Real sequences then get no work item and the output is silently wrong. The rectangular positions above already break on that layout, so it is not a regression. Addassert q_rows_bs >= scheduled_bs.