Skip to content

Commit 07fb739

Browse files
authored
[Feature][HiSparse] Enable bulk AscendStore pooling in colocated serving (#21924)
### What this PR does / why we need it? Enable whole-block AscendStore prefix reuse alongside HiSparse on one Ascend 950 node. HiSparse offloads historical main KV to local DDR and manages Resident and Hot pages. AscendStore saves and restores Host Source and NPU Indexer pages. This builds on #20926. The design and acceptance criteria are in #22762. - **Registration and layout.** Host and device block counts are separate. Runner V2 reserves alignment headroom before allocation so the backend can bind Indexer, Resident, and Hot views to the shared 2 MiB-aligned slab. AscendStore uses the logical BF16 Indexer stride and transfers the C8 key and scale without padding. - **Replay and buffer lifetime.** MemCache batches Host GETs up to 256 MiB. Core publishes imported pages after all ranks complete. Unsent cancellations release their destination pages through the same completion path. Startup sizing and partial-hit admission share the same Resident limit. - **MTP writes.** The save hook flushes pending draft Host rows before recording the PUT event. The sender waits before writing and the queue drains before source slots can be reused. The hook adapts Core's draft DMA/event state until Core exposes a public flush hook. ### Does this PR introduce _any_ user-facing change? Yes. Use Runner V2, a Core build with Ascend HiSparse support, and a `MultiConnector` containing exactly one `HiSparseConnector` and one `AscendStoreConnector`. Use `kv_role=kv_both`, `prefill_context_parallel_size=1`, `backend=memcache` with `host_tcp`, `load_async=true`, `discard_partial_chunks=true`, and `eager_host_mirror=true`. The supported deployment is single-node colocated Prefill and Decode. Stock Core v0.33.0 rejects HiSparse on Ascend. [Setup and replay verification](https://github.com/vllm-project/vllm-ascend/blob/3478a0edaa38d85f1f8a054c3eb985cceb286154/docs/source/user_guide/feature_guide/hisparse.md#combining-hisparse-with-ascendstore) The `hisparse-ascendstore-v1` namespace separates pool entries by target/draft checkpoint identity, shard selection, effective model configuration, and page geometry. Use a versioned path for new local weights. Mooncake support is deferred because a timed-out PUT can corrupt a different object. [Mooncake #4491](kvcache-ai/Mooncake#4491) ### How was this patch tested? - **Current CPU regression (`3478a0edaa`).** On both the pinned Core and v0.34.0, 606 passed and 12 skipped per version across separate KV-pool and request-lifecycle runs. Online replay is documented for manual verification. - **Earlier CI.** Pre-commit and CPU suites passed on the pinned Core and v0.33.0. The A3 four-card shard passed on retry after an HCCL port conflict. [CI for `7ad28087`](https://github.com/vllm-project/vllm-ascend/actions/runs/45325358239/attempts/2) - **Earlier manual A5 C8 replay.** GLM-5.3 W4A4C8 MXFP4, TP8, eager, MTP=3, MemCache 1.3.0 `host_tcp`, CANN 9.2.1, Core `ba15685ab`. At 2K and 16K, the HiSparse-only local hit, the combined local hit, and the forced external hit matched on 32 token IDs, selected logprobs, and top-5 logprobs. Both external replays had zero local hits and computed only the final 128 tokens. A 1+128-token Prefill split also passed byte-for-byte verification across all eight ranks. - **Other A5 checks.** BF16 128K cold, half-hit, and full-hit completed with matching outputs on `9d25dd270`. Earlier lab runs covered receive failure and cancellation, local recompute after a failed GET, and MemCache registration rollback. - **Earlier performance (`085a2e0b0`).** GLM-5.3 W4A4 MXFP4, A5 TP8, eager, MTP off, concurrency 4, 256 output tokens per request. The two workloads used 8 and 16 requests per arm, respectively. With AscendStore enabled, 16K cold TPOT P99 changed from 512.17 to 520.88 ms/token (+1.70%), and throughput from 6.415 to 6.399 tokens/s (−0.25%). With a 120K local hit on 128K input, P99 changed from 384.73 to 386.38 ms/token (+0.43%), and throughput from 8.864 to 8.861 tokens/s (−0.04%). The maximum rank-local PUT queue wait in the 128K case was 310.08 ms. ### Checklist - [x] Boundary, failure, and regression coverage - [x] A5 MTP=3 external replay - [x] A5 PUT queue and TPOT measurements for the configurations above - vLLM main: vllm-project/vllm@c410543 --------- Signed-off-by: Lin Haohong <1605058857@qq.com> Co-authored-by: Lin Haohong <esir98@users.noreply.github.com>
1 parent 4f49ae3 commit 07fb739

43 files changed

Lines changed: 3795 additions & 243 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/source/user_guide/feature_guide/hisparse.md‎

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ and native C8 (E4M3FN values with FP32 scales), with independent Main and
2727
Indexer KV dtype selection. The A2/A3 extension does not add a BF16 HiSparse
2828
serving path or change the existing non-HiSparse BF16 path.
2929

30+
On a single Ascend 950 node with colocated Prefill and Decode, you can
31+
[combine HiSparse with AscendStore](#combining-hisparse-with-ascendstore)
32+
to offload historical KV to local DDR and reuse full KV blocks from MemCache
33+
across requests.
34+
3035
### Constraints and Limitations
3136

3237
| Category | Constraint |
@@ -84,6 +89,52 @@ For a `MultiConnector` configuration, put `transfer_backend` in the
8489
`HiSparseConnector` child's extra configuration. This setting selects
8590
the private Host allocator. Omitting it uses native ACL Host-memory registration.
8691

92+
### Combining HiSparse with AscendStore
93+
94+
AscendStore saves and restores Host Source and NPU Indexer pages. HiSparse
95+
manages the Host Source, Resident, and Hot buffers.
96+
97+
Use the vLLM Core revision pinned by the matching vLLM Ascend build with
98+
Ascend HiSparse support. Keep the attention options above and pass the following
99+
JSON to `--kv-transfer-config`.
100+
101+
```json
102+
{
103+
"kv_connector": "MultiConnector",
104+
"kv_role": "kv_both",
105+
"kv_connector_extra_config": {
106+
"connectors": [
107+
{
108+
"kv_connector": "HiSparseConnector",
109+
"kv_role": "kv_both",
110+
"kv_connector_extra_config": {"host_pool_gib": 4}
111+
},
112+
{
113+
"kv_connector": "AscendStoreConnector",
114+
"kv_role": "kv_both",
115+
"kv_connector_extra_config": {"backend": "memcache", "load_async": true}
116+
}
117+
]
118+
}
119+
}
120+
```
121+
122+
See [KV Cache Pool](kv_cache_pool_ascend_store.md) for MemCache setup and
123+
[AscendStore settings](#ascendstore-settings) for the required options.
124+
See [Monitoring AscendStore prefix reuse](#monitoring-ascendstore-prefix-reuse)
125+
for the metrics to check after startup.
126+
Mooncake support is deferred pending a fix for
127+
[PUT timeout data corruption](https://github.com/kvcache-ai/Mooncake/issues/4491).
128+
129+
AscendStore keys for HiSparse use the `hisparse-ascendstore-v1` namespace.
130+
This version identifies the external pool key format. The keys include the
131+
target and draft checkpoint identities, resolved revisions, dummy-weight mode,
132+
filename patterns for `sharded_state` and `runai_streamer_sharded`, effective
133+
model configurations (including RoPE settings), and page layout. If the Hub revision
134+
resolver is unavailable, pin the checkpoint commit when sharing a persistent
135+
pool. Use a versioned directory when replacing local weights in a persistent
136+
pool. Files overwritten in place keep the same model path.
137+
87138
### Verifying the Feature
88139

89140
Send a request and check the server's metrics endpoint for the HiSparse miss
@@ -93,12 +144,33 @@ counter. The counter can stay at zero when selected rows are already on the NPU.
93144
curl -fsS http://127.0.0.1:8000/metrics | grep '^vllm:hisparse_cache_misses_total'
94145
```
95146

147+
#### Monitoring AscendStore prefix reuse
148+
149+
Check the server's `/metrics` endpoint for
150+
`vllm:external_prefix_cache_hits_total` to track prefix hits in MemCache and
151+
`vllm:ascend_store_load_get_keys_total` to track keys read by AscendStore.
152+
A request served from the local prefix cache may leave both counters unchanged.
153+
96154
## Configuration Parameters
97155

98-
| Parameter | Meaning |
156+
| Parameter | Description |
99157
| --- | --- |
100158
| `hisparse_config` | Enables Core HiSparse for the supported sparse Attention backend. |
101159
| `eager_host_mirror` | Keep `true` for this foundation; Core maintains the Host KV mirror. |
102160
| `host_pool_gib` | Host pool size in GiB per tensor-parallel rank. Size it for the planned context lengths and concurrency; the example reserves 4 GiB per rank. |
103161
| `device_buffer_size` | Per-request Hot capacity in KV rows. It must hold the deduplicated union of rows selected during speculative verification and fit the resolver's on-chip UB budget. |
104162
| `kv_cache_dtype` / `indexer_kv_dtype` | Select main and Indexer KV formats independently from model-weight quantization. |
163+
164+
### AscendStore settings
165+
166+
| Parameter | Description |
167+
| --- | --- |
168+
| `kv_connector` / `kv_role` | In `--kv-transfer-config`, use `MultiConnector` with one `HiSparseConnector` and one `AscendStoreConnector`. Set `kv_role=kv_both` on the parent and both children. |
169+
| `backend` / `load_async` | In the AscendStore child's `kv_connector_extra_config`, set `backend=memcache` and `load_async=true`. |
170+
| `use_layerwise` / `discard_partial_chunks` | In the AscendStore child's `kv_connector_extra_config`, keep `use_layerwise=false` and `discard_partial_chunks=true` for whole-block transfers. |
171+
| `protocol` | Set to `host_tcp` in the MemCache local configuration. |
172+
| `hisparse_config.eager_host_mirror` | Set to `true` in `--attention-config`, including for Prefill-only saves. |
173+
| `prefill_context_parallel_size` | Keep at `1`. |
174+
175+
To fall back to local computation after an external load fails, set
176+
`kv_load_failure_policy=recompute` in `--kv-transfer-config`.

‎release_notes/fragments/21924.yaml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
pr: 21924
2+
entries:
3+
- category: feature
4+
text: >-
5+
Added experimental, opt-in AscendStore prefix reuse for HiSparse on A5
6+
with Prefill and Decode colocated on a single node.
7+
Enabling it requires a vLLM build with Ascend HiSparse support,
8+
`MultiConnector` with `kv_role=kv_both` on the parent and both children,
9+
MemCache `host_tcp`, and `load_async=true`, `discard_partial_chunks=true`,
10+
and `eager_host_mirror=true`.
11+
PD disaggregation, prefill context parallelism, layerwise transfers,
12+
and Mooncake are unsupported in this combination.
13+
hardware: [A5]

0 commit comments

Comments
 (0)