Repository navigation
[ROCm][Perf] Add AITER FlashKDA prefill backend for GLM KDA #63568
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
eppaneamd
wants to merge
11
commits into
vllm-project:main
Choose a base branch
from
eppaneamd:rocm-aiter-flashkda-glm-kda-prefill
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.
+352
−17
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
20339d6
[ROCm][Perf] Add AITER FlashKDA prefill backend for GLM KDA
eppaneamd 48af33a
Merge branch 'main' into rocm-aiter-flashkda-glm-kda-prefill
eppaneamd fdcf5e7
Merge branch 'main' into rocm-aiter-flashkda-glm-kda-prefill
eppaneamd 8da5b15
Merge branch 'main' into rocm-aiter-flashkda-glm-kda-prefill
eppaneamd f7f9512
[ROCm] KDA: read the prefill backend only on steps with prefills
eppaneamd 63c0105
Merge branch 'main' into rocm-aiter-flashkda-glm-kda-prefill
eppaneamd cc2676c
[ROCm] KDA: run the FlashKDA parity test in CI, and on a segmented se…
eppaneamd 4dc4288
Merge branch 'main' into rocm-aiter-flashkda-glm-kda-prefill
eppaneamd 972c5a7
Use single backticks in the docstrings this PR adds
eppaneamd 03a7660
[ROCm] Raise ValueError for an unsupported KDA prefill backend in the…
eppaneamd c0d91fd
[ROCm] Correct the comment above ns_out in the GLM KDA layer
eppaneamd 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM project | ||
| """GLM-5.3-Flash KDA prefill through AITER FlashKDA on ROCm. Nothing here | ||
| needs a GPU: the platform and the AITER probe are faked.""" | ||
|
|
||
| import pytest | ||
| import torch | ||
|
|
||
| from vllm._aiter_ops import rocm_aiter_ops | ||
| from vllm.models.glm5next.common import kda | ||
| from vllm.v1.attention.backends.gdn_attn import GDNAttentionMetadata | ||
|
|
||
|
|
||
| def test_rocm_flashkda_resolves_to_aiter(monkeypatch): | ||
| """``--kda-prefill-backend flashkda`` selects AITER FlashKDA on ROCm | ||
| instead of being rejected.""" | ||
| monkeypatch.setattr(kda.current_platform, "is_rocm", lambda: True) | ||
| monkeypatch.setattr( | ||
| rocm_aiter_ops, "is_kda_flashkda_prefill_available", lambda: True | ||
| ) | ||
| backend = kda._resolve_kda_prefill_backend( | ||
| "flashkda", | ||
| head_dim=128, | ||
| dtype=torch.bfloat16, | ||
| lower_bound=-5.0, | ||
| state_dtype=torch.float32, | ||
| ) | ||
| assert backend == "aiter_flashkda" | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| ("num_spec_decodes", "expected"), [(0, True), (1, False)], ids=["no-spec", "spec"] | ||
| ) | ||
| def test_aiter_flashkda_skips_steps_with_spec_tokens(num_spec_decodes, expected): | ||
| """Steps that carry speculative-decode tokens keep the Triton chunk path.""" | ||
| spec_tokens = 4 * num_spec_decodes | ||
| metadata = GDNAttentionMetadata( | ||
| num_prefills=2, | ||
| num_prefill_tokens=74, | ||
| num_decodes=0, | ||
| num_decode_tokens=0, | ||
| num_spec_decodes=num_spec_decodes, | ||
| num_spec_decode_tokens=spec_tokens, | ||
| num_actual_tokens=74 + spec_tokens, | ||
| spec_sequence_masks=( | ||
| torch.tensor([True] * num_spec_decodes + [False] * 2) | ||
| if num_spec_decodes | ||
| else None | ||
| ), | ||
| ) | ||
| assert kda._aiter_flashkda_runs_prefill("aiter_flashkda", metadata) is expected |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.