Skip to content

[Misc] Integrate PyTorch 2.13 graph and AOT compatibility fixes - #23961

Open
tangdafu wants to merge 7 commits into
vllm-project:mainfrom
tangdafu:codex/torch213-graph-schema-ci
Open

tangdafu wants to merge 7 commits into
vllm-project:mainfrom
tangdafu:codex/torch213-graph-schema-ci

Conversation

@tangdafu

@tangdafu tangdafu commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

Integrate the PyTorch/TorchNPU 2.13 upgrade with the current graph-operator, distributed and AOT-cache compatibility fixes so they can be validated together. The stack is rebuilt linearly on main at 9370b515a0a6dce2b406e66b7f8db9fa24bc5f49, with one commit per source PR, one integration-metadata commit and a minimal ACLNN macro build fix.

Source PR Source head Included changes
#22603 2ca76fe8eee3fc8544733a900d0363792204d097 PyTorch/TorchNPU 2.13, matching TorchVision/TorchAudio, XLite for PyTorch 2.13, and dependency documentation.
#24292 e779ada89235965ccf03ab97676a7e2301e539b4 Disable unsupported Mega AOT artifacts before cache/backend decisions. Includes the current restart regression with a named worker-extension RPC and restricted serialization.
#23557 84e541f9bc8929393bdf34f6ea381d2d101959c1 Align LoRA/MLA/operator schemas; includes the 310P rotary-embedding wrapper and ACLNN workspace lifetime fix.
#24142 df481f8dcaa0b11dcb68821e7122d1b0d52ef0a0 Preserve collective inputs, declare MoE reductions in-place, return independent EP/SP bypass outputs, and use physical TP groups.

Runtime/build pins are PyTorch/TorchNPU 2.13.0, TorchVision 0.28.0, TorchAudio 2.11.0, memcache-hybrid===1.5.0.dev20261201 and memfabric-hybrid===1.5.0.dev20261128. Development and nightly requirements both use xlite==0.2.0rc7.dev213.

The ACLNN command macro uses a block comment for its workspace-lifetime note. A line comment followed by a continuation backslash otherwise consumes the rest of the macro and prevents device-extension compilation. The workspace tensor lifetime itself is unchanged.

Integration metadata adds the explicit Callable registry type required by mypy, registers the new E2E file with the existing 600-second default scheduling estimate, and consolidates release notes in release_notes/fragments/23961.yaml. The estimate is for load balancing, not a hardware measurement. The earlier separate Engram/Gloo test modification is retained in the backup branch; this rebuild takes that file from the selected main base.

The Mega AOT guard targets upstream vLLM's existing environment getter at platform startup because worker-only initialization can run after cache hashing and backend selection. It clears a cached getter, is idempotent, has process lifetime and adds no per-request work. Ordinary FX AOT caching and ACL Graph controls remain available. No new environment variable/configuration key is introduced. Remove the patch when supported upstream versions supply compiler-capability checks, complete-artifact validation and FX fallback. HCCL copy overhead, 310P wrapper copies and NPU warm-start behavior require hardware validation.

Does this PR introduce any user-facing change?

Yes. Reinstall the pinned runtime/build dependencies before rebuilding the Ascend extension, and reinstall XLite before using XliteGraph. Ascend disables VLLM_USE_MEGA_AOT_ARTIFACT even when explicitly set to 1; existing Mega cache entries are bypassed and the next startup may recompile. The ordinary AOT cache remains supported. Release notes are consolidated in release_notes/fragments/23961.yaml.

How was this patch tested?

  • Current revision: 52d5b68351, rebased onto main at 9370b515a0. CI 46898397717 has passed pre-commit and select-tests. Resolve source snapshot succeeded using event base 9370b515a0, and all 229 E2E files passed configuration coverage. Both CPU UT variants have started; device-build/NPU results remain pending. No content conflicts remain.
  • Previous CI 46896005896 on a383b4b925 passed pre-commit but stopped in Resolve source snapshot: its event base was daa051092b, while main had changed the A3 CANN image/cache configuration in Revert "[Feature] Bump CANN base image timestamp to 9.3.0_20261201230000" #24283. The workflow deliberately rejected mixing those CSRC control versions. CPU UT and NPU jobs were skipped, so that run did not validate the macro fix on hardware. CODEOWNERS approvals remain independently required.
  • After the rebase: all 40 feature paths remain, 39 are byte-identical to the pre-rebase revision, and the remaining MoE test file incorporates upstream coverage. All four CSRC control files match main, dependency pins and the block-comment macro fix are preserved, 23 changed Python files parse, git diff --check passes, 5 isolated Mega AOT tests pass, and coverage configuration still validates with 229/229 E2E files registered. Ran full bash format.sh ci again with the same Windows hook limitations; no NPU result is claimed.
  • Before the macro fix, CI 46887844168 on 2b01961cd6 passed pre-commit, selection and both CPU UT variants. All ten A3 two-card/four-card shards failed during device-extension installation, before tests ran, with expected-while/unmatched-brace errors from the shared EXEC_NPU_CMD macro. Other shards were still running when inspected.
  • Macro fix validation: libclang 18 parsed the actual macro token stream and a C++17 minimal probe. Before the fix the closing while (false) tokens were absent and the probe reproduced the syntax errors; after replacing // with a block comment, the complete macro body is present and the probe has no syntax errors. Ran full bash format.sh ci again: applicable checks, including clang-format, passed; the same Windows /bin/bash, ShellCheck and hook-regex limitations remain. Full NPU extension compilation is CI only.
  • 5 passed for tests/ut/patch/platform/test_patch_mega_aot.py using an isolated Windows / Python 3.12 / PyTorch 2.13 CPU environment with pytest --noconftest -p no:cacheprovider -q. This exercises the startup override without device-dependent patch imports.
  • Mypy 1.11.1 on the Mega AOT unit-test file with CI flags --follow-imports skip --check-untyped-defs --python-version, targeting Python 3.10, 3.11 and 3.12: all passed.
  • Complete coverage.py configuration validation and the new test's routing preview: passed, 229/229 E2E files registered, routed to a one-card A2 runner. Local Windows checks used slash-separated path strings to match Linux CI.
  • Source parity at the initial rebuild base 78b6808fde: in an isolated index, reversing the four source patches in reverse order exactly recovered that upstream main tree. Verified the final 40 changed paths belong to the four PRs or the documented integration metadata; parsed all 23 changed Python files, compiled the embedded startup script, checked dependency pins, PO string syntax and release YAML, and passed git diff --check. No merge commits or unmerged entries remain.
  • Ran full bash format.sh ci: Ruff, formatting, codespell, typos, clang-format, Markdown lint, Actionlint and the available repository checks passed. The Windows environment still lacks /bin/bash, ShellCheck and regex in the forbidden-import hook interpreter; full local lint therefore did not pass. Linux CI and documentation builds must validate the final stack.
  • NPU validation: CI testing only. Run both fusion/npugraph_ex cache-restart variants, 310P RoPE, LoRA and distributed collective regressions on actual hardware. Full CPU UT, NPU correctness and performance results are pending; no hardware result is claimed.

Checklist

Testing

  • Boundary / edge-case coverage across the combined stack

  • Regression tests included from the source PRs

  • Startup override error/fallback behavior tested locally

  • Tests assert startup state, independent outputs and cache reuse

  • Combined full CPU UT and NPU tests

  • Performance impact measured

  • vLLM main: vllm-project/vllm@65ada0c

tangdafu added a commit to tangdafu/vllm-ascend that referenced this pull request Nov 30, 2026
Add the vllm-project#23961 release fragment for the dependency upgrade and graph compatibility fixes. The fragment parses successfully and the diff has no whitespace errors.

Signed-off-by: t00911734 <tangdafu@huawei.com>
@tangdafu

tangdafu commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

/e2e tests/e2e/pull_request/four_card/context_parallel/pool/test_deepseek_v4_pool.py tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py tests/e2e/pull_request/four_card/context_parallel/test_deepseek_v4.py tests/e2e/pull_request/four_card/model_runner_v2/test_deepseek_v4.py tests/e2e/pull_request/four_card/model_runner_v2/test_qwen38_pp_mtp_prefix_cache.py tests/e2e/pull_request/one_card/_310p/test_dense_model_310p.py tests/e2e/pull_request/one_card/_310p/test_embedding_310p.py tests/e2e/pull_request/one_card/lora/test_llama32_lora.py tests/e2e/pull_request/one_card/lora/test_lora_with_spec_decode.py tests/e2e/pull_request/one_card/lora/test_olmoe_lora.py tests/e2e/pull_request/one_card/model_runner_v2/test_deepseek_mtp.py tests/e2e/pull_request/one_card/model_runner_v2/test_deepseek_v2_lite_w8a8_basic.py tests/e2e/pull_request/two_card/lora/test_qwen35_4b_multi_lora_mtp_aclgraph.py tests/e2e/pull_request/two_card/lora/test_qwen35_densemodel_lora_tp.py tests/e2e/pull_request/two_card/model_runner_v2/test_data_parallel.py tests/e2e/pull_request/two_card/model_runner_v2/test_qwen3_5_eagle3.py tests/e2e/pull_request/two_card/pooling/test_qwen3_embedding_mrv2.py tests/e2e/pull_request/two_card/ops/test_bgmv_expand.py

[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

@github-actions github-actions Bot added documentation Improvements or additions to documentation module:tests module:ops labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

🤖 How to trigger CI

CI runs automatically when the PR is opened or reopened. Pushing a new commit no longer re-runs the E2E CI (to save NPU runner resources), so use the comment commands below when needed. They are available to the PR author and users with triage permission or above:

  • /run — run the full PR CI gate on the latest commit.
  • /rerun — re-run the failed CI jobs (e.g. after a flaky failure).
  • /e2e — run selected E2E tests instead of the full gate.
  • /nightly / /presmoke / /weekly — run the corresponding large-scale tests (triage permission or above; blocked during the nightly maintenance window).
  • /cancel — cancel a running CI on this PR.

Note

Until the CI gate has run on a commit, the required ci-gate check stays pending and the PR cannot merge — remember to comment /run after pushing.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the pinned PyTorch and TorchNPU dependency versions to 2.13.0, along with compatible versions of torchvision, torchaudio, and memfabric/memcache-hybrid. Additionally, it refactors several custom operators (such as bgmv_expand, sgmv_expand, mla_preprocess, and dispatch_ffn_combine) to update their output tensors in-place and return void instead of returning tensors, allowing AOTAutograd to properly functionalize the writes. Corresponding meta-kernels, Python wrappers, and unit tests have been updated to match these new signatures. The fake implementation for RoPE has also been updated to return fresh contiguous tensors, cloning inputs when necessary to preserve them. I have no feedback to provide as there are no review comments to evaluate.

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Total Coverage Diff Coverage
Total 167148 lines 131 lines
Missing 45291 lines 20 lines
Coverage 73% 84%

More info see: Summary

@tangdafu

tangdafu commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

/e2e tests/e2e/pull_request/four_card/context_parallel/pool/test_deepseek_v4_pool.py tests/e2e/pull_request/four_card/context_parallel/test_accuracy_v2.py tests/e2e/pull_request/four_card/context_parallel/test_deepseek_v4.py tests/e2e/pull_request/four_card/model_runner_v2/test_deepseek_v4.py tests/e2e/pull_request/four_card/model_runner_v2/test_qwen38_pp_mtp_prefix_cache.py tests/e2e/pull_request/one_card/_310p/test_dense_model_310p.py tests/e2e/pull_request/one_card/_310p/test_embedding_310p.py tests/e2e/pull_request/one_card/lora/test_llama32_lora.py tests/e2e/pull_request/one_card/lora/test_lora_with_spec_decode.py tests/e2e/pull_request/one_card/lora/test_olmoe_lora.py tests/e2e/pull_request/one_card/model_runner_v2/test_deepseek_mtp.py tests/e2e/pull_request/one_card/model_runner_v2/test_deepseek_v2_lite_w8a8_basic.py tests/e2e/pull_request/two_card/lora/test_qwen35_4b_multi_lora_mtp_aclgraph.py tests/e2e/pull_request/two_card/lora/test_qwen35_densemodel_lora_tp.py tests/e2e/pull_request/two_card/model_runner_v2/test_data_parallel.py tests/e2e/pull_request/two_card/model_runner_v2/test_qwen3_5_eagle3.py tests/e2e/pull_request/two_card/pooling/test_qwen3_embedding_mrv2.py tests/e2e/pull_request/two_card/ops/test_bgmv_expand.py

[Bot]: e2e command triggered. See workflow run for details.
[Bot]: e2e command failed.

@pisceskkk pisceskkk added the ready-precise run selected e2e test for pr label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Last updated: 2026-12-04 02:33 UTC+8 for commit 0576b3a.

ci-gate failed. Reason:

CODEOWNERS approval gate failed: at least one changed file has no approval from its owner(s). Open the 'CODEOWNERS' steps above to see which files are missing approvals and who can approve.
The 'ready-precise' selected tests failed. Open the failed job(s) inside the run-selected-tests matrix above and fix the failing test(s) or the code change that broke them.

See the workflow run for full logs. This comment is updated in place on each new failure and marked as passed once the gate passes (it is kept for history, not deleted).

Missing owner approvals. Every changed file needs one approval from its CODEOWNERS owner(s):

Unclaimed module touched (1 file). These files have no CODEOWNERS owner yet, so no approval is required for them; maintainers will handle claiming:

  • vllm_ascend/models/common/ops/sequence_parallel.py

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@tangdafu

tangdafu commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

/run
[Bot]: run command accepted. E2E has been queued on the latest commit 2d3522ef53f42072df28e90e6664a047d8c114f8 of this PR, with whatever test-scope labels the PR currently carries. Track progress in PR checks.

@vllm-ascend-ci vllm-ascend-ci added the ci-run E2E requested manually on the latest commit label Dec 2, 2026
@vllm-ascend-ci vllm-ascend-ci added ci-run E2E requested manually on the latest commit and removed ci-run E2E requested manually on the latest commit labels Dec 2, 2026
@tangdafu
tangdafu force-pushed the codex/torch213-graph-schema-ci branch from 28cd096 to 2b01961 Compare December 2, 2026 13:02
@tangdafu

tangdafu commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

/run
[Bot]: run command accepted. E2E has been queued on the latest commit 2b01961cd6ad3632bcfe0e89668bc9521ef0e264 of this PR, with whatever test-scope labels the PR currently carries. Track progress in PR checks.

@vllm-ascend-ci vllm-ascend-ci added ci-run E2E requested manually on the latest commit and removed ci-run E2E requested manually on the latest commit labels Dec 2, 2026
@tangdafu

tangdafu commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

/run
[Bot]: run command accepted. E2E has been queued on the latest commit a383b4b925332ae5f238d0bb4dfb2ddd8fec6dd1 of this PR, with whatever test-scope labels the PR currently carries. Track progress in PR checks.

@vllm-ascend-ci vllm-ascend-ci added ci-run E2E requested manually on the latest commit and removed ci-run E2E requested manually on the latest commit labels Dec 2, 2026
@tangdafu
tangdafu force-pushed the codex/torch213-graph-schema-ci branch from a383b4b to 52d5b68 Compare December 2, 2026 14:02
@tangdafu

tangdafu commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

/run
[Bot]: run command accepted. E2E has been queued on the latest commit 52d5b6835125e4ee59e88b33c06d3f456c38eb2e of this PR, with whatever test-scope labels the PR currently carries. Track progress in PR checks.

@vllm-ascend-ci vllm-ascend-ci added ci-run E2E requested manually on the latest commit and removed ci-run E2E requested manually on the latest commit labels Dec 2, 2026
@tangdafu

tangdafu commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

/rerun
[Bot]: rerun completed.

Rerun (failed jobs only):

  • E2E

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

tangdafu and others added 7 commits December 3, 2026 22:38
Apply the net code, documentation and test changes from vllm-project#22603 at 2ca76fe on the rebuilt integration branch.

Source release fragments are consolidated in PR 23961. Runtime and hardware validation remain for the combined CI run.

Signed-off-by: t00911734 <tangdafu@huawei.com>
Apply the net code, documentation and test changes from vllm-project#24292 at e779ada on the rebuilt integration branch.

Source release fragments are consolidated in PR 23961. Runtime and hardware validation remain for the combined CI run.

Signed-off-by: t00911734 <tangdafu@huawei.com>
Apply the net code, documentation and test changes from vllm-project#23557 at 84e541f on the rebuilt integration branch.

Source release fragments are consolidated in PR 23961. Runtime and hardware validation remain for the combined CI run.

Co-authored-by: ZT-AIA <1028681969@qq.com>
Co-authored-by: yanhao <1537360619@qq.com>
Co-authored-by: Yaphets24 <d_mym0618@163.com>
Signed-off-by: t00911734 <tangdafu@huawei.com>
Apply the net code, documentation and test changes from vllm-project#24142 at df481f8 on the rebuilt integration branch.

Source release fragments are consolidated in PR 23961. Runtime and hardware validation remain for the combined CI run.

Signed-off-by: t00911734 <tangdafu@huawei.com>
Keep the previously requested MemFabric 20261128, Memcache 20261201 and XLite rc7.dev213 pins. Add the existing Mega AOT registry annotation and the default 600-second scheduling estimate, and consolidate user-facing release notes under PR 23961. The rebuilt stack contains the latest net changes from PRs 22603, 24292, 23557 and 24142 plus these integration adjustments; the old extra Engram test patch is retained only in the backup branch.

Validation: five isolated AOT tests passed; target mypy checks passed for Python 3.10, 3.11 and 3.12; all 23 changed Python files and the startup script parsed; complete coverage configuration and A2 routing passed with 229/229 registered E2E files. Reversing the four source patches in an isolated index exactly recovered the upstream base tree. Full format checks retain the known Windows hook limitations. NPU validation is CI only.
Signed-off-by: t00911734 <tangdafu@huawei.com>
The workspace-lifetime change in PR 23557 added a // comment inside EXEC_NPU_CMD. Backslash-newline splicing occurs before comment removal, so the comment consumes the remaining macro body including its closing do/while. Device extension builds fail with expected-while and unmatched-brace errors before any E2E case starts. Use a block comment and retain the intended workspace tensor lifetime.

Validated with libclang 18: the original real macro token stream lacks the closing while and the minimal C++17 probe reproduces expected-while errors; the fixed token stream includes the complete body and the probe has no syntax errors. All ten failed A3 shards in CI 46887844168 reached the same device-build failure. git diff --check and applicable lint checks pass; full local format checks retain the known Windows dependency limitations. Full NPU build validation remains for CI.

Signed-off-by: t00911734 <tangdafu@huawei.com>
torch-npu 2.13.0 can allocate the first shared-expert temporary outside
the graph pool when the input wait is enqueued from the auxiliary
stream. Replaying the graph can then read a freed SwiGLU input.

Enqueue the same event wait on the shared stream before entering its
context. Check the calling stream for the input and router waits in
the existing MoE regression test.

The DeepSeek multistream TP2 generation test passed with dummy weights
on two A3 NPUs with torch-npu 2.10.0.post7 and 2.13.0.

Signed-off-by: t00911734 <tangdafu@huawei.com>
(cherry picked from commit a3e52b3)
Signed-off-by: t00911734 <tangdafu@huawei.com>
@tangdafu
tangdafu force-pushed the codex/torch213-graph-schema-ci branch from 52d5b68 to 0576b3a Compare December 3, 2026 14:44
@tangdafu

tangdafu commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

/run
[Bot]: run command accepted. E2E has been queued on the latest commit 0576b3a8c5bd5f86b8eff86fd9f6513ce802b917 of this PR, with whatever test-scope labels the PR currently carries. Track progress in PR checks.

@vllm-ascend-ci vllm-ascend-ci added ci-run E2E requested manually on the latest commit and removed ci-run E2E requested manually on the latest commit labels Dec 3, 2026
@tangdafu

tangdafu commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

/rerun
[Bot]: rerun completed.

Rerun (failed jobs only):

  • E2E

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-run E2E requested manually on the latest commit documentation Improvements or additions to documentation module:ops module:tests ready-precise run selected e2e test for pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants