mirror of
https://github.com/lightseekorg/tokenspeed.git
synced 2026-11-25 09:35:40 +08:00
## Scope Refactor Ascend runtime attention, cache workspace preparation and MoE execution contracts. This consolidates #3498, #3573 and #3596 on top of #3563. - Separate DSA decode resources from shared context-parallel metadata, and reuse the metadata lifecycle across DSA and MLA. - Share recipe-sized QCP Prefill workspace preparation and transport across attention backends, with explicit layout and capacity contracts. - Centralize scheduler-derived MoE source counts and refresh the graph-owned buffer before replay. - Clarify W4A4 weight preparation and common-registry ownership, while retaining FP32 normalization scales for BF16 inputs. Model plugins select their numerical execution paths through these runtime interfaces. Sampling and logprob reduction retain the existing runtime policy. ## Review fixes - Reject DP-local decode graphs for models requiring global MoE source counts; use the communication layer's scatter calculation. Startup profiling uploads the selected packed tier's row count and restores capture metadata, including on failure. - Keep persistent CUDA count buffers in the memory saver's CPU-backed runtime region. Cover repeated release/resume, contents and addresses. Register the packed profiling regression in CUDA CI. - Pass cache-recipe workspace layouts through the shared QCP Prefill preparation path, removing the NPU package's reverse dependency. Restore transport input validation and cover dynamic metadata parameters without recompilation. - Make W4A4 layout choices explicit, update the common registry regression, and test fused DSA operator rejection at binding time. Restore KVP 2/4/8/16 LSE coverage, exact FP32-scale sensitivity, invalid FlatQuant clip checks and both cache-probe sizing cases. - Update the scheduler test fixture for the cache-storage contract reported by NVIDIA and AMD CI, and refresh the renamed NPU metadata test entry point. The existing DSA constructor's optional decode flag remains compatible with callers that previously supplied only `prefill_enabled`. Low-level packing helpers retain their separately tested geometry; the model support constraints remain unchanged. ## Validation CPU contract tests passed: 413 runtime/kernel tests and a follow-up selection of 126 runner tests (with overlap). `pre-commit run --all-files` passes. Ascend 910B: 297 metadata graph/stream regressions, 25 transport-kernel cases, 10 normalization cases and 8 real INT4 NZ/GMM cases passed. The two-rank QCP transport run passed 34 byte-exact scenarios per rank, covering KV-only and KV+index layouts, empty owners, shared pages and fragmented history. The two scheduler fixture regressions also passed with the matching engine package. CUDA packed profiling regressions passed on NVIDIA B200 and AMD MI350. The attention contract follow-up passed 160 CPU tests and 25 subtests; `pre-commit run --all-files` passes. --------- Signed-off-by: zhuhaozhecool <zhuhaozhecool@163.com> Signed-off-by: 7huahua <26763681+7huahua@users.noreply.github.com> Co-authored-by: 7huahua <26763681+7huahua@users.noreply.github.com>