Repository navigation
[Feature][HiSparse] Mooncake MemFabric Pull into shared Offload Host - #22109
LifeOfCoffee wants to merge 2 commits into
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 introduces support for MemFabric transport within the Mooncake connector, specifically targeting HiSparse offloading. It enables efficient P/D (Prefill/Decode) KV transfer by utilizing 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
|
There was a problem hiding this comment.
Code Review
This pull request integrates Mooncake MemFabric Pull transport into the shared Offload Host for HiSparse, allowing direct main KV imports into the Host Source without a second staging pool. The changes span across the transfer engine, connector workers, host pool allocation logic, documentation, and unit tests. The review feedback suggests restructuring the PR title and summary to align with the repository style guide, and identifies a critical missing import of wraps in vllm_ascend/hisparse/host_pool.py that would cause a runtime NameError.
|
👋 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 [Feature] 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! |
|
Last updated: 2026-11-25 18:10 UTC+8 for commit ci-gate failed. Reason:
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 modules touched (6 files). These files have no CODEOWNERS owner yet, so no approval is required for them; maintainers will handle claiming:
|
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
5d7f6e6 to
74be4bc
Compare
820de49 to
aadc906
Compare
312cf34 to
aabbcab
Compare
aabbcab to
50a0389
Compare
50a0389 to
b448bd3
Compare
b448bd3 to
cd52dc0
Compare
) ### What this PR does / why we need it? #22062 enables native AIV access to CPU KV storage on Ascend A2/A3. The native registration path relies on `aclrtHostMemMapCapabilities` supporting AIV Host mapping, available with HDK 26.1 or newer. Many A3 deployments still use HDK 25.5.1. On that stack, the capability query returns `207000` and HiSparse fails to start. When a `HiSparseConnector` explicitly sets `"transfer_backend": "memfabric"`, allocate the private per-rank Host pool with MemFabric AccOffload in LOCAL mode and use its device virtual address for AIV refill. The adapter keeps Core's existing backing and registration contract and releases its arena after Core drains device work. MemFabric 1.3.0 uses its process-local allocator. MemFabric 1.3.1 provides a dedicated allocator for each arena. The same option is read from a `HiSparseConnector` inside `MultiConnector`. The adapter provides LOCAL Host allocation on the existing Host-pool contract. In the HiSparse P/D design in #22109, `MooncakeConnectorV2` selects its transport independently and the P/D manager owns SHARED backing. When integrating the branches, the P/D manager can select the explicit LOCAL allocator for local HiSparse and keep its separate SHARED ownership and lifetime rules. This preserves the Host-pool contract for future P/D integration. The A3 validation covers LOCAL allocation and connector selection. End-to-end P/D transport qualification remains with #22109. ### Does this PR introduce _any_ user-facing change? Yes. On A3 with HDK 25.5.1, users can start HiSparse with the following KV transfer configuration. The serving environment needs the A3 MemFabric AccOffload extension. When it is missing, build it after sourcing CANN with `mfcli kernel install --soc-version A3`. ```bash --kv-transfer-config '{"kv_connector":"HiSparseConnector","kv_role":"kv_both","kv_connector_extra_config":{"host_pool_gib":8,"transfer_backend":"memfabric"}}' ``` Omitting the option keeps native ACL Host registration as the default. ### How was this patch tested? - **Focused checks.** Ruff and `git diff --check` passed. Twelve selected Host-pool tests passed on the A3 runtime with each SDK, MemFabric 1.3.0 and 1.3.1. Tests cover direct and nested connector selection, initialization-config fallback, ACL default, address offsets, empty DVA rollback, and allocator shutdown. - **Repository lint.** Ruff, codespell, typos, Markdown lint, and the Python policy hooks passed. The full lint run could not bootstrap actionlint because of dependency download failures. ShellCheck and offline gitleaks require local binaries and are deferred to CI. - **A3 hardware.** With the candidate Host-pool code, both SDK versions passed native AIV refill with byte and LRU checks, cross-stream ACL Graph replay, and asynchronous D2H with 16 and 17 copy descriptors. The test closed and recreated the arena in the same process. ```bash pytest -q tests/ut/distributed/kv_transfer/test_hisparse_foundation_cpu.py \ -k 'private_host_allocator or memfabric_host_pool or mapped_addresses_retain_offsets' ``` **A3 serving performance.** GLM-5.3 W8A8 on A3 with HDK 25.5.1.1, CANN 9.2.1, INT8 KV and Indexer, TP16 with EP, MTP4, FlashComm1 disabled, and an 8,192-token batch limit. Serving used `FULL_DECODE_ONLY`, a 69,632-token context limit, and up to eight sequences. HiSparse ON used MemFabric 1.3.1 in LOCAL mode and 10,240 device slots. Each mode ran two rounds of the same eight GSM8K-derived requests at concurrency 1, after two warmups per round. Each measured request used 32,768 input tokens and 1,024 forced greedy output tokens. Prefix-cache hits and preemptions were zero. | Metric | HiSparse OFF | HiSparse ON (MemFabric) | Change (OFF → ON) | | --- | ---: | ---: | ---: | | Mean TTFT (s) | 10.98 | 11.43 | +4.18% | | Mean TPOT (ms) | 11.36 | 12.54 | +10.35% | | Mean ITL (ms) | 45.52 | 47.82 | +5.05% | | Mean MTP accepted length | 4.003 | 3.814 | -4.73% | | End-to-end output throughput (tokens/s) | 45.31 | 42.21 | -6.85% | Percentage changes are calculated from the unrounded means as `(ON − OFF) / OFF × 100%`. **Full GSM8K accuracy.** The same deployment evaluated all 1,319 items with the GLM chat template, AISBench `gsm8k_gen_4_shot_cot_str` prompts, and numeric scoring after reasoning extraction. Both modes used temperature 0, top_p 1, seed 1024, a 4,096-token output limit, and concurrency 8. | Metric | HiSparse OFF | HiSparse ON (MemFabric) | | --- | ---: | ---: | | Correct / total | 1,287 / 1,319 | 1,281 / 1,319 | | Accuracy | 97.57% | 97.12% | | Failed requests | 0 | 0 | The full-model results used vLLM Core `ba15685ab7` and vLLM Ascend `603191058` with this PR’s Host-pool code. Full serving validation on the current upstream Core pin `c410543d9` is pending. --- ### Checklist #### Testing - [x] **Boundary / edge-case coverage** - [x] **Regression test** - [x] **Error / failure path coverage** - [x] **Meaningful & reliable tests** - [ ] **Performance impact** (manual A3 benchmarks are included) - vLLM main: vllm-project/vllm@c410543 --------- Signed-off-by: LZZhang-HW <239167139+LZZhang-HW@users.noreply.github.com> Co-authored-by: LZZhang-HW <239167139+LZZhang-HW@users.noreply.github.com>
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
507ce56 to
da9f065
Compare
Esir98
left a comment
There was a problem hiding this comment.
One concern about the shared Host KV restore on A5.
3e7cca1 to
1d05fbe
Compare
zhenwenqi2024
left a comment
There was a problem hiding this comment.
The pre-commit job fails mypy on Python 3.10–3.12 at test_hisparse_foundation_cpu.py:411: list.append() returns None, and initialized.append(config) or 0 uses it as a value. Could we replace the lambda with a small initialize(config) -> int helper that appends the config and explicitly returns 0? That keeps the same fixture and return contract while unblocking the CPU and selected hardware jobs.
|
/run |
|
/rerun Failed:
|
wangxiyuan
left a comment
There was a problem hiding this comment.
The fragment release_notes/fragments/22109.yaml has the correct filename and pr: 22109, uses the valid feature category, and names the exact opt-in switch transfer_backend=memfabric under kv_connector_extra_config while stating the feature is off by default and listing its TP/PCP/DCP constraints, which meets the feature-entry bar in release_notes/README.md. Approved.
|
/run |
|
/run |
|
/rerun [Bot]: rerun completed. Failed:
|
|
/rerun Rerun (failed jobs only):
|
Add the Ascend HiSparse shared Host pool and MemFabric Pull path. Restore mapped pages with a single sparse_copy submission and cover the connector and worker paths with CPU tests. Signed-off-by: LifeOfCoffee <lcyzhyx@163.com>
zhenwenqi2024
left a comment
There was a problem hiding this comment.
Could MemFabricSharedHostRegion coordinate the offload.initialize(config) result across TP ranks before proceeding? If the SDK returns nonzero on just one rank, that rank raises while the successful peers enter group.barrier() and wait for a rank that has already exited. The leader-only error broadcasts before and after this step do not cover a follower's init failure. Reusing Core's GroupCoordinator.cpu_all_reduce_ for a small failure flag would let every rank take the same error path. Could we extend the existing SDK fixture with a TP2 case where only rank 1 returns nonzero and assert that neither rank proceeds to bind the pool?
…oss TP ranks Signed-off-by: LifeOfCoffee <lcyzhyx@163.com>
Addressed your comment |
|
/run |
What changes
Extend #20926 with direct P/D Pull from ordinary Prefill KV into HiSparse on Decode. Set
transfer_backend=memfabricinMooncakeConnectorV2to select the native MemFabric TransferEngine. Decode pulls MLA main KV directly into its MemFabric Offload Host Source and Indexer KV into each rank's NPU.Core pairing and Ascend Worker
Build with unmodified vLLM Core
c410543d9ffff03f5f6c4a8c0ae1d3ad082c4a15, pinned in.github/vllm-main-verified.commit.AscendHiSparseConnectorWorkerextends the upstream HiSparse worker with Ascend DMA setup, recycled-block invalidation, H→D DMA for batched Host-to-Resident restore, and TP synchronization for rank-0 Host writeback.AscendHiSparseOffloadManagertakes the engine configuration from the existingHiSparseHostPoolinstance and owns the physical Host allocation and sharing.MultiConnectorcombination can overlap Target Host writeback with MTP drafting and waits for the Host copy before reporting readiness.A5 startup example
On each node, set
MODEL_PATHto the local GLM-5.2 W4A8C8 model directory andVLLM_HOST_IPto the node's own reachable address. The example uses TP8 and PCP=1 on both sides. Send inference requests through a P/D proxy.Prefill (ordinary KV, eager)
Decode (HiSparse,
FULL_DECODE_ONLY)Keep
HiSparseConnectorfirst in the DecodeMultiConnectorlist. To reproduce the MTP functional check, add--speculative-config '{"method":"mtp","num_speculative_tokens":1}'to both commands.Full-model A5 validation
Validated at
820de494dewith GLM-5.2 W4A8C8 and TP8 per node. Prefill ran in eager mode with HiSparse disabled. Decode used HiSparse withFULL_DECODE_ONLY. Transfer used native MemFabric1.5.0.dev20261115withtransfer_backend=memfabricandmemfabric_transfer_protocol=device_urma.Earlier reduced-model measurements
An earlier A5 eager run with 10-layer GLM-5.3 MXFP8 and P/D TP2 matched local Decode on eight-token continuations for 5, 301, 2,049, 4,097 and 8,193 input tokens, plus a repeated 301-token request. It recorded 62,050 Host refill misses and 101,299,520 Host-to-device bytes. Both Decode ranks mapped the same 1 GiB Host backing. A separate earlier pairing also matched these cases with
FULL_DECODE_ONLYand capture size 1.Scope and qualification
This PR covers bulk Pull. AscendStore pooling and layerwise transfer are outside its scope. Shared Host allocation requires a single Decode node with multiprocessing and PP=PCP=DCP=1. The results above are tied to their tested revisions and configurations. The current Core pairing still needs end-to-end NPU qualification.
AI assistance was used for implementation, investigation, tests and this description.