[BugFix][xlite] Fix DP metadata handling in XliteWrapper and pass down the max number of tokens across all DP ranks for collective communications. - #11213
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a metadata handling issue in the xlite backend when Data Parallelism (DP) is enabled. By calculating and passing the maximum number of tokens across all DP ranks, the change ensures that collective communications in MoE layers remain symmetric, preventing potential errors during model execution. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. Tip 💡 Consider Linking a Related Issue or RFCYour PR title contains the [BugFix] tag, indicating a bug fix or new feature. Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:
🙏 Thanks for helping us keep the project well-organized! |
There was a problem hiding this comment.
Code Review
Suggested PR Title:
[Ops][Feature] Support Data Parallelism alignment in XLite graph runnerSuggested PR Summary:
### What this PR does / why we need it?
This PR introduces support for Data Parallelism (DP) alignment in the XLite graph runner. Specifically, when `data_parallel_size > 1`, `num_tokens` is determined by the maximum number of tokens across all DP ranks. It also defers the instantiation of `AttnMetadataRouter` to avoid unnecessary overhead when falling back to the runnable.
Feedback: A potential `AttributeError` was identified because `forward_context.dp_metadata` can be `None` during profiling or warmup runs. A defensive check should be added to ensure `dp_metadata` is not `None` before accessing its attributes.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
CI testing with DP configurations.4a9e1e5 to
8d57f51
Compare
3b356cd to
c5de28b
Compare
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
ff59215 to
b6614b5
Compare
f91d433 to
b6e9d71
Compare
b6e9d71 to
d3f1588
Compare
d3f1588 to
16c56cc
Compare
…n the max number of tokens across all DP ranks for collective communications. Signed-off-by: Sijie Fu <fusijie@huawei.com>
16c56cc to
365a786
Compare
…eekV32ForCausalLM` and `GlmMoeDsaForCausalLM`) in the xlite adapter (#13378) ### What this PR does / why we need it? Add xlite adapter support for Deepseek-V3-style Multi-head Latent Attention (MLA) and Deepseek-V3.2 / GLM-5 / GLM-5.1-style Deepseek Sparse Attention (DSA), enabling `xlite full` / `xlite decode-only` serving for these architectures. It bundles three commits: 1. **[Feature][xlite] Support DeepseekV3ForCausalLM with MLA attention in xlite adapter** - **Special note** on `XliteWrapper.__call__`: when multiple attention metadata entries are present, it now picks the layer-0 self-attn entry by key (`"model.layers.0.self_attn.attn"`) rather than `next(iter(...))`, so the correct MLA metadata is selected for the model. 2. **[Feature][xlite] Support DeepseekV32ForCausalLM and GlmMoeDsaForCausalLM deepseek sparse attention (DSA) in xlite adapter** - **Special note** on `XliteWrapper.register_kv_caches`: DSA passes two KV-cache entries per layer — an indexer `k_cache` and a `(k_nope_cache, pe_cache)` pair. When `len(kv_caches) == 2 * n_layers`, the wrapper reshuffles the flat list into the per-layer triples `[(indexer_k_cache, k_nope_cache, pe_cache), ...]` that the xlite DSA runtime expects. 3. **[Doc][xlite] Update XliteGraph documentation for new models and modes** ### Does this PR introduce _any_ user-facing change? No public API change. This adds internal xlite adapter classes (`DeepseekV3XliteModel`, `DeepseekV32XliteModel`) under `vllm_ascend/xlite/`, registered through the existing `_architecture_strategy_map`. The new classes extend the set of architectures xlite can serve (`DeepseekV3ForCausalLM`, `DeepseekV32ForCausalLM`, `GlmMoeDsaForCausalLM`) but do not change behavior for previously supported models. End-to-end serving behavior for xlite-backed MLA/DSA models is newly enabled by this PR. ### How was this patch tested? We benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with 208 questions from the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across both MLA and DSA architectures and TP/DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models 2~DeepSeek-V3.1-w8a8-mtp-QuaRot 2~GLM-5.1-w8a8 \ --tps 16 8 16 8 \ --dps 1 2 1 2 \ --eps 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline: | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 90.64 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 91.38 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 91.31 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 90.94 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 91.60 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 91.16 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 92.50 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 93.24 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 93.61 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 93.46 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 92.35 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 92.64 | ### Note to reviewers This PR depends on the previous PR #11213 for the DP metadata alignment fix. PR #11213 must be merged first. - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a --------- Signed-off-by: Sijie Fu <fusijie@huawei.com> Co-authored-by: LuLina <lina.lulina@huawei.com>
…into vllm-new # By shenhui-cli (8) and others # Via GitHub (1) and shenhui-cli (1) * 'vllm-new' of https://github.com/shenhui-cli/vllm-ascend: (34 commits) When the PR modifies any files in the CSRC folder, skip the test case filtering logic and execute all test cases by default. [MRV2][Bugfix] Fix two triton ops errors in model_runner_v2 num_nans_kernel and apply_panalties (vllm-project#13159) [Cherry-pick][main][Doc][BugFix] Update proxy script name in DeepSeek-V3.2 tutorial (from vllm-project#13537) (vllm-project#13575) [Refactor][quantization]remove mxfp_compat compatibility shim and inline dtype references (vllm-project#13447) [MTP][BugFix] Preserve MoE weight loaders during online updates (vllm-project#13337) [Feature][xlite] Support MLA and DSA (`DeepseekV3ForCausalLM`, `DeepseekV32ForCausalLM` and `GlmMoeDsaForCausalLM`) in the xlite adapter (vllm-project#13378) [BugFix][xlite] Fix DP metadata handling in XliteWrapper and pass down the max number of tokens across all DP ranks for collective communications. (vllm-project#11213) [Refactor][Ops] Move expert routing into router classes (vllm-project#13417) [Platform][Refactor] Refactor NPUPlatform for better organization and clarity (vllm-project#13484) [BugFix] fix fiaV2 contiguous err in GQA (vllm-project#13456) [feature][KV Offload] Support Sparse KV Cache Offload (vllm-project#13026) [Bugfix][MRV2]Skip D2H copy and synchronize when spec decode is not active (vllm-project#13382) [Bugfix] Change AscendSFAIndexerCacheSpec to inherit MLAAttentionSpec (vllm-project#12849) [BugFix][FusedMoE] Restore BF16 quant method initialization (vllm-project#13412) [Doc] Fix link errors and add section anchors (vllm-project#13485) [TEST]Revise the A3 case (vllm-project#13495) [CI] modify default cann_version and add build_type support in nightly (vllm-project#13480) [CI]Improve logging, optimize function-level recommendation algorithm, and add early exit for no product code changes (vllm-project#13472) This PR restricts the test case discovery scope to the following directories: tests/e2e/pull_request/ tests/ut/ This PR restricts the test case discovery scope to the following directories: tests/e2e/pull_request/ tests/ut/ ... # Conflicts: # .github/workflows/scripts/test_selector.py
…n the max number of tokens across all DP ranks for collective communications. (vllm-project#11213) ### What this PR does / why we need it? Fix `XliteWrapper` to consume the correct DP metadata and align the max number of tokens across all DP ranks for collective communications, and bump the pinned `xlite` dependency to `0.2.0rc0`. **Why**: Under data parallelism (DP), each DP rank serves a different number of tokens, but the xlite runtime issues collective communications that require every rank to pass an identical, padded token count. Previously `XliteWrapper` read `forward_context.batch_descriptor.num_tokens` (the per-rank token count) and sized the working `hidden_states` slice from it. That value diverges across DP ranks, so the collectives mismatched and produced wrong/unaligned results. The fix sources the token count from `forward_context.max_tokens_across_dp`, which the vLLM-Ascend forward context already computes as `max(num_tokens_across_dp_cpu)` and pads to a TP-aligned length — the same value the rest of the stack uses for MoE comm method selection. The detailed issue can be found in xlite repo's [issue vllm-project#15](https://atomgit.com/openeuler/GVirt/issues/15). And xlite [PR vllm-project#339](https://atomgit.com/openeuler/GVirt/pull/339) fixes this issue in xlite backend. **What changed** (`vllm_ascend/xlite/xlite.py`): - In the xlite forward path, `num_tokens` is now taken from `forward_context.max_tokens_across_dp` instead of `forward_context.batch_descriptor.num_tokens`. The hidden-states buffer slice `self.hidden_states[:num_tokens]` is therefore sized to the DP-aligned maximum, keeping all ranks in lock-step for the underlying collectives. The comment is updated to record that, under DP, `num_tokens` is the max number of tokens across all DP ranks for data alignment. - `XliteWrapper.__init__` no longer derives `local_rank` from `get_world_group().local_rank`; the runtime `devid` is now `device.index` and `rank` is `torch.distributed.get_rank()` directly. `get_world_group` is dropped from the imports, and the one-shot `rank`/`local_rank` locals are inlined at their use sites. - `StandardXliteModel`: `xlite_config.max_m` (the full-mode capacity) is now rounded up with `math.ceil(max_num_batched_tokens / tp_size) * tp_size` so it is TP-aligned and consistent with the downstream. - `MiniMaxM2XliteModel`: sets `xlite_config.gate_captured = False`. - `requirements-dev.txt`: `xlite==0.1.0rc12.dev210` → `xlite==0.2.0rc0` to pick up the upstream runtime fixes that the metadata alignment above relies on. DP test cases were also added to the e2e script at `tests/e2e/pull_request/two_card/test_xlite.py`. ### Does this PR introduce _any_ user-facing change? No public API change. This fixes an internal correctness bug in `XliteWrapper`'s DP metadata handling and bumps the dev-only `xlite` pin in `requirements-dev.txt`. Serving behavior for non-DP xlite configurations is unchanged; DP configurations now use the DP-aligned token count for collective communications. ### How was this patch tested? The e2e test passes locally with `pytest tests/e2e/pull_request/two_card/test_xlite.py`. We also benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across dense, MoE, and DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models Qwen3-32B Qwen3-VL-32B-Instruct 2~Qwen3-30B-A3B 2~MiniMax-M2.7-w8a8-QuaRot 2~GLM-4.7-W8A8-floatmtp \ --tps 4 4 4 2 8 4 8 4 \ --dps 1 1 1 1 1 2 1 2 \ --eps 0 0 1 1 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` **No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline:** | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 88.26 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 88.19 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 86.70 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 86.92 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 86.85 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 87.44 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite full | weighted_average | 85.22 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite decode-only | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | aclgraph | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite full | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite decode-only | weighted_average | 86.11 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | aclgraph | weighted_average | 85.14 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 82.24 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 82.76 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 81.80 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 83.43 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 84.03 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 82.47 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 90.71 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 91.01 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 90.49 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 90.12 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 90.56 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 90.27 | - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a Signed-off-by: Sijie Fu <fusijie@huawei.com>
…eekV32ForCausalLM` and `GlmMoeDsaForCausalLM`) in the xlite adapter (vllm-project#13378) ### What this PR does / why we need it? Add xlite adapter support for Deepseek-V3-style Multi-head Latent Attention (MLA) and Deepseek-V3.2 / GLM-5 / GLM-5.1-style Deepseek Sparse Attention (DSA), enabling `xlite full` / `xlite decode-only` serving for these architectures. It bundles three commits: 1. **[Feature][xlite] Support DeepseekV3ForCausalLM with MLA attention in xlite adapter** - **Special note** on `XliteWrapper.__call__`: when multiple attention metadata entries are present, it now picks the layer-0 self-attn entry by key (`"model.layers.0.self_attn.attn"`) rather than `next(iter(...))`, so the correct MLA metadata is selected for the model. 2. **[Feature][xlite] Support DeepseekV32ForCausalLM and GlmMoeDsaForCausalLM deepseek sparse attention (DSA) in xlite adapter** - **Special note** on `XliteWrapper.register_kv_caches`: DSA passes two KV-cache entries per layer — an indexer `k_cache` and a `(k_nope_cache, pe_cache)` pair. When `len(kv_caches) == 2 * n_layers`, the wrapper reshuffles the flat list into the per-layer triples `[(indexer_k_cache, k_nope_cache, pe_cache), ...]` that the xlite DSA runtime expects. 3. **[Doc][xlite] Update XliteGraph documentation for new models and modes** ### Does this PR introduce _any_ user-facing change? No public API change. This adds internal xlite adapter classes (`DeepseekV3XliteModel`, `DeepseekV32XliteModel`) under `vllm_ascend/xlite/`, registered through the existing `_architecture_strategy_map`. The new classes extend the set of architectures xlite can serve (`DeepseekV3ForCausalLM`, `DeepseekV32ForCausalLM`, `GlmMoeDsaForCausalLM`) but do not change behavior for previously supported models. End-to-end serving behavior for xlite-backed MLA/DSA models is newly enabled by this PR. ### How was this patch tested? We benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with 208 questions from the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across both MLA and DSA architectures and TP/DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models 2~DeepSeek-V3.1-w8a8-mtp-QuaRot 2~GLM-5.1-w8a8 \ --tps 16 8 16 8 \ --dps 1 2 1 2 \ --eps 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline: | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 90.64 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 91.38 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 91.31 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 90.94 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 91.60 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 91.16 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 92.50 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 93.24 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 93.61 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 93.46 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 92.35 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 92.64 | ### Note to reviewers This PR depends on the previous PR vllm-project#11213 for the DP metadata alignment fix. PR vllm-project#11213 must be merged first. - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a --------- Signed-off-by: Sijie Fu <fusijie@huawei.com> Co-authored-by: LuLina <lina.lulina@huawei.com>
…n the max number of tokens across all DP ranks for collective communications. (vllm-project#11213) ### What this PR does / why we need it? Fix `XliteWrapper` to consume the correct DP metadata and align the max number of tokens across all DP ranks for collective communications, and bump the pinned `xlite` dependency to `0.2.0rc0`. **Why**: Under data parallelism (DP), each DP rank serves a different number of tokens, but the xlite runtime issues collective communications that require every rank to pass an identical, padded token count. Previously `XliteWrapper` read `forward_context.batch_descriptor.num_tokens` (the per-rank token count) and sized the working `hidden_states` slice from it. That value diverges across DP ranks, so the collectives mismatched and produced wrong/unaligned results. The fix sources the token count from `forward_context.max_tokens_across_dp`, which the vLLM-Ascend forward context already computes as `max(num_tokens_across_dp_cpu)` and pads to a TP-aligned length — the same value the rest of the stack uses for MoE comm method selection. The detailed issue can be found in xlite repo's [issue vllm-project#15](https://atomgit.com/openeuler/GVirt/issues/15). And xlite [PR vllm-project#339](https://atomgit.com/openeuler/GVirt/pull/339) fixes this issue in xlite backend. **What changed** (`vllm_ascend/xlite/xlite.py`): - In the xlite forward path, `num_tokens` is now taken from `forward_context.max_tokens_across_dp` instead of `forward_context.batch_descriptor.num_tokens`. The hidden-states buffer slice `self.hidden_states[:num_tokens]` is therefore sized to the DP-aligned maximum, keeping all ranks in lock-step for the underlying collectives. The comment is updated to record that, under DP, `num_tokens` is the max number of tokens across all DP ranks for data alignment. - `XliteWrapper.__init__` no longer derives `local_rank` from `get_world_group().local_rank`; the runtime `devid` is now `device.index` and `rank` is `torch.distributed.get_rank()` directly. `get_world_group` is dropped from the imports, and the one-shot `rank`/`local_rank` locals are inlined at their use sites. - `StandardXliteModel`: `xlite_config.max_m` (the full-mode capacity) is now rounded up with `math.ceil(max_num_batched_tokens / tp_size) * tp_size` so it is TP-aligned and consistent with the downstream. - `MiniMaxM2XliteModel`: sets `xlite_config.gate_captured = False`. - `requirements-dev.txt`: `xlite==0.1.0rc12.dev210` → `xlite==0.2.0rc0` to pick up the upstream runtime fixes that the metadata alignment above relies on. DP test cases were also added to the e2e script at `tests/e2e/pull_request/two_card/test_xlite.py`. ### Does this PR introduce _any_ user-facing change? No public API change. This fixes an internal correctness bug in `XliteWrapper`'s DP metadata handling and bumps the dev-only `xlite` pin in `requirements-dev.txt`. Serving behavior for non-DP xlite configurations is unchanged; DP configurations now use the DP-aligned token count for collective communications. ### How was this patch tested? The e2e test passes locally with `pytest tests/e2e/pull_request/two_card/test_xlite.py`. We also benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across dense, MoE, and DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models Qwen3-32B Qwen3-VL-32B-Instruct 2~Qwen3-30B-A3B 2~MiniMax-M2.7-w8a8-QuaRot 2~GLM-4.7-W8A8-floatmtp \ --tps 4 4 4 2 8 4 8 4 \ --dps 1 1 1 1 1 2 1 2 \ --eps 0 0 1 1 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` **No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline:** | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 88.26 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 88.19 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 86.70 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 86.92 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 86.85 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 87.44 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite full | weighted_average | 85.22 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite decode-only | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | aclgraph | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite full | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite decode-only | weighted_average | 86.11 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | aclgraph | weighted_average | 85.14 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 82.24 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 82.76 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 81.80 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 83.43 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 84.03 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 82.47 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 90.71 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 91.01 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 90.49 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 90.12 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 90.56 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 90.27 | - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a Signed-off-by: Sijie Fu <fusijie@huawei.com>
…eekV32ForCausalLM` and `GlmMoeDsaForCausalLM`) in the xlite adapter (vllm-project#13378) ### What this PR does / why we need it? Add xlite adapter support for Deepseek-V3-style Multi-head Latent Attention (MLA) and Deepseek-V3.2 / GLM-5 / GLM-5.1-style Deepseek Sparse Attention (DSA), enabling `xlite full` / `xlite decode-only` serving for these architectures. It bundles three commits: 1. **[Feature][xlite] Support DeepseekV3ForCausalLM with MLA attention in xlite adapter** - **Special note** on `XliteWrapper.__call__`: when multiple attention metadata entries are present, it now picks the layer-0 self-attn entry by key (`"model.layers.0.self_attn.attn"`) rather than `next(iter(...))`, so the correct MLA metadata is selected for the model. 2. **[Feature][xlite] Support DeepseekV32ForCausalLM and GlmMoeDsaForCausalLM deepseek sparse attention (DSA) in xlite adapter** - **Special note** on `XliteWrapper.register_kv_caches`: DSA passes two KV-cache entries per layer — an indexer `k_cache` and a `(k_nope_cache, pe_cache)` pair. When `len(kv_caches) == 2 * n_layers`, the wrapper reshuffles the flat list into the per-layer triples `[(indexer_k_cache, k_nope_cache, pe_cache), ...]` that the xlite DSA runtime expects. 3. **[Doc][xlite] Update XliteGraph documentation for new models and modes** ### Does this PR introduce _any_ user-facing change? No public API change. This adds internal xlite adapter classes (`DeepseekV3XliteModel`, `DeepseekV32XliteModel`) under `vllm_ascend/xlite/`, registered through the existing `_architecture_strategy_map`. The new classes extend the set of architectures xlite can serve (`DeepseekV3ForCausalLM`, `DeepseekV32ForCausalLM`, `GlmMoeDsaForCausalLM`) but do not change behavior for previously supported models. End-to-end serving behavior for xlite-backed MLA/DSA models is newly enabled by this PR. ### How was this patch tested? We benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with 208 questions from the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across both MLA and DSA architectures and TP/DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models 2~DeepSeek-V3.1-w8a8-mtp-QuaRot 2~GLM-5.1-w8a8 \ --tps 16 8 16 8 \ --dps 1 2 1 2 \ --eps 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline: | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 90.64 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 91.38 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 91.31 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 90.94 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 91.60 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 91.16 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 92.50 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 93.24 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 93.61 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 93.46 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 92.35 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 92.64 | ### Note to reviewers This PR depends on the previous PR vllm-project#11213 for the DP metadata alignment fix. PR vllm-project#11213 must be merged first. - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a --------- Signed-off-by: Sijie Fu <fusijie@huawei.com> Co-authored-by: LuLina <lina.lulina@huawei.com>
…n the max number of tokens across all DP ranks for collective communications. (vllm-project#11213) ### What this PR does / why we need it? Fix `XliteWrapper` to consume the correct DP metadata and align the max number of tokens across all DP ranks for collective communications, and bump the pinned `xlite` dependency to `0.2.0rc0`. **Why**: Under data parallelism (DP), each DP rank serves a different number of tokens, but the xlite runtime issues collective communications that require every rank to pass an identical, padded token count. Previously `XliteWrapper` read `forward_context.batch_descriptor.num_tokens` (the per-rank token count) and sized the working `hidden_states` slice from it. That value diverges across DP ranks, so the collectives mismatched and produced wrong/unaligned results. The fix sources the token count from `forward_context.max_tokens_across_dp`, which the vLLM-Ascend forward context already computes as `max(num_tokens_across_dp_cpu)` and pads to a TP-aligned length — the same value the rest of the stack uses for MoE comm method selection. The detailed issue can be found in xlite repo's [issue vllm-project#15](https://atomgit.com/openeuler/GVirt/issues/15). And xlite [PR vllm-project#339](https://atomgit.com/openeuler/GVirt/pull/339) fixes this issue in xlite backend. **What changed** (`vllm_ascend/xlite/xlite.py`): - In the xlite forward path, `num_tokens` is now taken from `forward_context.max_tokens_across_dp` instead of `forward_context.batch_descriptor.num_tokens`. The hidden-states buffer slice `self.hidden_states[:num_tokens]` is therefore sized to the DP-aligned maximum, keeping all ranks in lock-step for the underlying collectives. The comment is updated to record that, under DP, `num_tokens` is the max number of tokens across all DP ranks for data alignment. - `XliteWrapper.__init__` no longer derives `local_rank` from `get_world_group().local_rank`; the runtime `devid` is now `device.index` and `rank` is `torch.distributed.get_rank()` directly. `get_world_group` is dropped from the imports, and the one-shot `rank`/`local_rank` locals are inlined at their use sites. - `StandardXliteModel`: `xlite_config.max_m` (the full-mode capacity) is now rounded up with `math.ceil(max_num_batched_tokens / tp_size) * tp_size` so it is TP-aligned and consistent with the downstream. - `MiniMaxM2XliteModel`: sets `xlite_config.gate_captured = False`. - `requirements-dev.txt`: `xlite==0.1.0rc12.dev210` → `xlite==0.2.0rc0` to pick up the upstream runtime fixes that the metadata alignment above relies on. DP test cases were also added to the e2e script at `tests/e2e/pull_request/two_card/test_xlite.py`. ### Does this PR introduce _any_ user-facing change? No public API change. This fixes an internal correctness bug in `XliteWrapper`'s DP metadata handling and bumps the dev-only `xlite` pin in `requirements-dev.txt`. Serving behavior for non-DP xlite configurations is unchanged; DP configurations now use the DP-aligned token count for collective communications. ### How was this patch tested? The e2e test passes locally with `pytest tests/e2e/pull_request/two_card/test_xlite.py`. We also benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across dense, MoE, and DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models Qwen3-32B Qwen3-VL-32B-Instruct 2~Qwen3-30B-A3B 2~MiniMax-M2.7-w8a8-QuaRot 2~GLM-4.7-W8A8-floatmtp \ --tps 4 4 4 2 8 4 8 4 \ --dps 1 1 1 1 1 2 1 2 \ --eps 0 0 1 1 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` **No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline:** | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 88.26 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 88.19 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 86.70 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 86.92 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 86.85 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 87.44 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite full | weighted_average | 85.22 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite decode-only | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | aclgraph | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite full | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite decode-only | weighted_average | 86.11 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | aclgraph | weighted_average | 85.14 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 82.24 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 82.76 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 81.80 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 83.43 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 84.03 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 82.47 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 90.71 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 91.01 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 90.49 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 90.12 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 90.56 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 90.27 | - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a Signed-off-by: Sijie Fu <fusijie@huawei.com>
…eekV32ForCausalLM` and `GlmMoeDsaForCausalLM`) in the xlite adapter (vllm-project#13378) ### What this PR does / why we need it? Add xlite adapter support for Deepseek-V3-style Multi-head Latent Attention (MLA) and Deepseek-V3.2 / GLM-5 / GLM-5.1-style Deepseek Sparse Attention (DSA), enabling `xlite full` / `xlite decode-only` serving for these architectures. It bundles three commits: 1. **[Feature][xlite] Support DeepseekV3ForCausalLM with MLA attention in xlite adapter** - **Special note** on `XliteWrapper.__call__`: when multiple attention metadata entries are present, it now picks the layer-0 self-attn entry by key (`"model.layers.0.self_attn.attn"`) rather than `next(iter(...))`, so the correct MLA metadata is selected for the model. 2. **[Feature][xlite] Support DeepseekV32ForCausalLM and GlmMoeDsaForCausalLM deepseek sparse attention (DSA) in xlite adapter** - **Special note** on `XliteWrapper.register_kv_caches`: DSA passes two KV-cache entries per layer — an indexer `k_cache` and a `(k_nope_cache, pe_cache)` pair. When `len(kv_caches) == 2 * n_layers`, the wrapper reshuffles the flat list into the per-layer triples `[(indexer_k_cache, k_nope_cache, pe_cache), ...]` that the xlite DSA runtime expects. 3. **[Doc][xlite] Update XliteGraph documentation for new models and modes** ### Does this PR introduce _any_ user-facing change? No public API change. This adds internal xlite adapter classes (`DeepseekV3XliteModel`, `DeepseekV32XliteModel`) under `vllm_ascend/xlite/`, registered through the existing `_architecture_strategy_map`. The new classes extend the set of architectures xlite can serve (`DeepseekV3ForCausalLM`, `DeepseekV32ForCausalLM`, `GlmMoeDsaForCausalLM`) but do not change behavior for previously supported models. End-to-end serving behavior for xlite-backed MLA/DSA models is newly enabled by this PR. ### How was this patch tested? We benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with 208 questions from the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across both MLA and DSA architectures and TP/DP configurations: ```bash # on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models 2~DeepSeek-V3.1-w8a8-mtp-QuaRot 2~GLM-5.1-w8a8 \ --tps 16 8 16 8 \ --dps 1 2 1 2 \ --eps 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline: | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 90.64 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 91.38 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 91.31 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 90.94 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 91.60 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 91.16 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 92.50 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 93.24 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 93.61 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 93.46 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 92.35 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 92.64 | ### Note to reviewers This PR depends on the previous PR vllm-project#11213 for the DP metadata alignment fix. PR vllm-project#11213 must be merged first. - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a --------- Signed-off-by: Sijie Fu <fusijie@huawei.com> Co-authored-by: LuLina <lina.lulina@huawei.com>
…n the max number of tokens across all DP ranks for collective communications. (vllm-project#11213) Fix `XliteWrapper` to consume the correct DP metadata and align the max number of tokens across all DP ranks for collective communications, and bump the pinned `xlite` dependency to `0.2.0rc0`. **Why**: Under data parallelism (DP), each DP rank serves a different number of tokens, but the xlite runtime issues collective communications that require every rank to pass an identical, padded token count. Previously `XliteWrapper` read `forward_context.batch_descriptor.num_tokens` (the per-rank token count) and sized the working `hidden_states` slice from it. That value diverges across DP ranks, so the collectives mismatched and produced wrong/unaligned results. The fix sources the token count from `forward_context.max_tokens_across_dp`, which the vLLM-Ascend forward context already computes as `max(num_tokens_across_dp_cpu)` and pads to a TP-aligned length — the same value the rest of the stack uses for MoE comm method selection. The detailed issue can be found in xlite repo's [issue xlite backend. **What changed** (`vllm_ascend/xlite/xlite.py`): - In the xlite forward path, `num_tokens` is now taken from `forward_context.max_tokens_across_dp` instead of `forward_context.batch_descriptor.num_tokens`. The hidden-states buffer slice `self.hidden_states[:num_tokens]` is therefore sized to the DP-aligned maximum, keeping all ranks in lock-step for the underlying collectives. The comment is updated to record that, under DP, `num_tokens` is the max number of tokens across all DP ranks for data alignment. - `XliteWrapper.__init__` no longer derives `local_rank` from `get_world_group().local_rank`; the runtime `devid` is now `device.index` and `rank` is `torch.distributed.get_rank()` directly. `get_world_group` is dropped from the imports, and the one-shot `rank`/`local_rank` locals are inlined at their use sites. - `StandardXliteModel`: `xlite_config.max_m` (the full-mode capacity) is now rounded up with `math.ceil(max_num_batched_tokens / tp_size) * tp_size` so it is TP-aligned and consistent with the downstream. - `MiniMaxM2XliteModel`: sets `xlite_config.gate_captured = False`. - `requirements-dev.txt`: `xlite==0.1.0rc12.dev210` → `xlite==0.2.0rc0` to pick up the upstream runtime fixes that the metadata alignment above relies on. DP test cases were also added to the e2e script at `tests/e2e/pull_request/two_card/test_xlite.py`. No public API change. This fixes an internal correctness bug in `XliteWrapper`'s DP metadata handling and bumps the dev-only `xlite` pin in `requirements-dev.txt`. Serving behavior for non-DP xlite configurations is unchanged; DP configurations now use the DP-aligned token count for collective communications. The e2e test passes locally with `pytest tests/e2e/pull_request/two_card/test_xlite.py`. We also benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across dense, MoE, and DP configurations: ```bash python batch_aisbench.py /root/benchmark \ -N 128 \ --models Qwen3-32B Qwen3-VL-32B-Instruct 2~Qwen3-30B-A3B 2~MiniMax-M2.7-w8a8-QuaRot 2~GLM-4.7-W8A8-floatmtp \ --tps 4 4 4 2 8 4 8 4 \ --dps 1 1 1 1 1 2 1 2 \ --eps 0 0 1 1 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` **No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline:** | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 88.26 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 88.19 | | Qwen3-32B | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 86.70 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite full | weighted_average | 86.92 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | xlite decode-only | weighted_average | 86.85 | | Qwen3-VL-32B-Instruct | ceval-weighted | 4 | N | 1 | aclgraph | weighted_average | 87.44 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite full | weighted_average | 85.22 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | xlite decode-only | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 4 | Y | 1 | aclgraph | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite full | weighted_average | 85.74 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | xlite decode-only | weighted_average | 86.11 | | Qwen3-30B-A3B | ceval-weighted | 2 | Y | 1 | aclgraph | weighted_average | 85.14 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 82.24 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 82.76 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 81.80 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 83.43 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 84.03 | | MiniMax-M2.7-w8a8-QuaRot | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 82.47 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite full | weighted_average | 90.71 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | xlite decode-only | weighted_average | 91.01 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 8 | Y | 1 | aclgraph | weighted_average | 90.49 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite full | weighted_average | 90.12 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | xlite decode-only | weighted_average | 90.56 | | GLM-4.7-W8A8-floatmtp | ceval-weighted | 4 | Y | 2 | aclgraph | weighted_average | 90.27 | - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a Signed-off-by: Sijie Fu <fusijie@huawei.com>
…eekV32ForCausalLM` and `GlmMoeDsaForCausalLM`) in the xlite adapter (vllm-project#13378) Add xlite adapter support for Deepseek-V3-style Multi-head Latent Attention (MLA) and Deepseek-V3.2 / GLM-5 / GLM-5.1-style Deepseek Sparse Attention (DSA), enabling `xlite full` / `xlite decode-only` serving for these architectures. It bundles three commits: 1. **[Feature][xlite] Support DeepseekV3ForCausalLM with MLA attention in xlite adapter** - **Special note** on `XliteWrapper.__call__`: when multiple attention metadata entries are present, it now picks the layer-0 self-attn entry by key (`"model.layers.0.self_attn.attn"`) rather than `next(iter(...))`, so the correct MLA metadata is selected for the model. 2. **[Feature][xlite] Support DeepseekV32ForCausalLM and GlmMoeDsaForCausalLM deepseek sparse attention (DSA) in xlite adapter** - **Special note** on `XliteWrapper.register_kv_caches`: DSA passes two KV-cache entries per layer — an indexer `k_cache` and a `(k_nope_cache, pe_cache)` pair. When `len(kv_caches) == 2 * n_layers`, the wrapper reshuffles the flat list into the per-layer triples `[(indexer_k_cache, k_nope_cache, pe_cache), ...]` that the xlite DSA runtime expects. 3. **[Doc][xlite] Update XliteGraph documentation for new models and modes** No public API change. This adds internal xlite adapter classes (`DeepseekV3XliteModel`, `DeepseekV32XliteModel`) under `vllm_ascend/xlite/`, registered through the existing `_architecture_strategy_map`. The new classes extend the set of architectures xlite can serve (`DeepseekV3ForCausalLM`, `DeepseekV32ForCausalLM`, `GlmMoeDsaForCausalLM`) but do not change behavior for previously supported models. End-to-end serving behavior for xlite-backed MLA/DSA models is newly enabled by this PR. We benchmarked model accuracies with multiple models using `aisbench`. The [batch_aisbench.py](https://atomgit.com/openeuler/GVirt/blob/master/xlite/tests/e2e/batch_aisbench.py) script was used with 208 questions from the `ceval` dataset, comparing `xlite full`, `xlite decode-only`, and `aclgraph` backends across both MLA and DSA architectures and TP/DP configurations: ```bash python batch_aisbench.py /root/benchmark \ -N 128 \ --models 2~DeepSeek-V3.1-w8a8-mtp-QuaRot 2~GLM-5.1-w8a8 \ --tps 16 8 16 8 \ --dps 1 2 1 2 \ --eps 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xlite ``` No accuracy regression is observed across the full matrix relative to the `aclgraph` baseline: | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 90.64 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 91.38 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 91.31 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 90.94 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 91.60 | | DeepSeek-V3.1-w8a8-mtp-QuaRot | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 91.16 | | Model | Dataset | TP | EP | DP | Backend | Metric | Accuracy | | --- | --- | --- | --- | --- | --- | --- | --- | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite full | weighted_average | 92.50 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | xlite decode-only | weighted_average | 93.24 | | GLM-5.1-w8a8 | ceval-weighted | 16 | Y | 1 | aclgraph | weighted_average | 93.61 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite full | weighted_average | 93.46 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | xlite decode-only | weighted_average | 92.35 | | GLM-5.1-w8a8 | ceval-weighted | 8 | Y | 2 | aclgraph | weighted_average | 92.64 | This PR depends on the previous PR vllm-project#11213 for the DP metadata alignment fix. PR vllm-project#11213 must be merged first. - vLLM version: v0.26.0 - vLLM main: vllm-project/vllm@0351e9a --------- Signed-off-by: Sijie Fu <fusijie@huawei.com> Co-authored-by: LuLina <lina.lulina@huawei.com> Signed-off-by: Sijie Fu <fusijie@huawei.com>
What this PR does / why we need it?
Fix
XliteWrapperto consume the correct DP metadata and align the max number of tokens across all DP ranks for collective communications, and bump the pinnedxlitedependency to0.2.0rc0.Why: Under data parallelism (DP), each DP rank serves a different number of tokens, but the xlite runtime issues collective communications that require every rank to pass an identical, padded token count. Previously
XliteWrapperreadforward_context.batch_descriptor.num_tokens(the per-rank token count) and sized the workinghidden_statesslice from it. That value diverges across DP ranks, so the collectives mismatched and produced wrong/unaligned results.The fix sources the token count from
forward_context.max_tokens_across_dp, which the vLLM-Ascend forward context already computes asmax(num_tokens_across_dp_cpu)and pads to a TP-aligned length — the same value the rest of the stack uses for MoE comm method selection.The detailed issue can be found in xlite repo's issue #15. And xlite PR #339 fixes this issue in xlite backend.
What changed (
vllm_ascend/xlite/xlite.py):num_tokensis now taken fromforward_context.max_tokens_across_dpinstead offorward_context.batch_descriptor.num_tokens. The hidden-states buffer sliceself.hidden_states[:num_tokens]is therefore sized to the DP-aligned maximum, keeping all ranks in lock-step for the underlying collectives. The comment is updated to record that, under DP,num_tokensis the max number of tokens across all DP ranks for data alignment.XliteWrapper.__init__no longer deriveslocal_rankfromget_world_group().local_rank; the runtimedevidis nowdevice.indexandrankistorch.distributed.get_rank()directly.get_world_groupis dropped from the imports, and the one-shotrank/local_ranklocals are inlined at their use sites.StandardXliteModel:xlite_config.max_m(the full-mode capacity) is now rounded up withmath.ceil(max_num_batched_tokens / tp_size) * tp_sizeso it is TP-aligned and consistent with the downstream.MiniMaxM2XliteModel: setsxlite_config.gate_captured = False.requirements-dev.txt:xlite==0.1.0rc12.dev210→xlite==0.2.0rc0to pick up the upstream runtime fixes that the metadata alignment above relies on.DP test cases were also added to the e2e script at
tests/e2e/pull_request/two_card/test_xlite.py.Does this PR introduce any user-facing change?
No public API change. This fixes an internal correctness bug in
XliteWrapper's DP metadata handling and bumps the dev-onlyxlitepin inrequirements-dev.txt. Serving behavior for non-DP xlite configurations is unchanged; DP configurations now use the DP-aligned token count for collective communications.How was this patch tested?
The e2e test passes locally with
pytest tests/e2e/pull_request/two_card/test_xlite.py.We also benchmarked model accuracies with multiple models using
aisbench. The batch_aisbench.py script was used with thecevaldataset, comparingxlite full,xlite decode-only, andaclgraphbackends across dense, MoE, and DP configurations:# on one Atlas A3 python batch_aisbench.py /root/benchmark \ -N 128 \ --models Qwen3-32B Qwen3-VL-32B-Instruct 2~Qwen3-30B-A3B 2~MiniMax-M2.7-w8a8-QuaRot 2~GLM-4.7-W8A8-floatmtp \ --tps 4 4 4 2 8 4 8 4 \ --dps 1 1 1 1 1 2 1 2 \ --eps 0 0 1 1 1 1 1 1 \ -MNS 128 \ -MML 8192 \ --xlite 2 1 0 \ --broadcast-xliteNo accuracy regression is observed across the full matrix relative to the
aclgraphbaseline: