[Performance](attention): fuse SFA DCP output all-to-all (#14457)
## What this PR changes This PR replaces the SFA DCP output post-processing hot path with a custom Ascend operator: - stride-aware Triton pack for the local attention output and LSE - one HCCL all-to-all instead of separate output/LSE collectives - fused numerically stable LSE combine and weighted output reduction - direct `torch.ops.vllm.sfa_dcp_a2a_fused` dispatch from `sfa_cp.py` - retained PyTorch two-A2A reference only for tests and A/B benchmarks ## Why The existing path materializes multiple PyTorch intermediates and performs two collectives. Fusing packing and reduction around one HCCL A2A reduces launch, synchronization, and communication overhead in the SFA DCP decode path. ## Performance ### Whole-model GLM5.2 online serving Configuration: TP8/DCP8, 4K input / 1K output, single concurrency, AISBench `data_num=4`, MTP disabled, DSA_CP disabled, FULL_DECODE_ONLY capture size 1. | Metric | PyTorch two-A2A | Fused custom op | Change | |---|---:|---:|---:| | TPOT | 51.5 ms | 47.8 ms | **-7.18%** | | Throughput | baseline | candidate | **+7.63%** | | TTFT | baseline | candidate | +1.15% | ### Final-commit TP8 operator benchmark BF16 shape `[1, 64, 256]`, 10 warmups and 30 measured iterations: - median wall time: `0.88115 ms -> 0.72612 ms` - latency improvement: **17.59%** (`1.214x`) - maximum absolute output error: `0.0078125` with benchmark `atol=rtol=0.02` ## Validation - Ascend Triton dtype/shape/layout/stride/special-LSE matrix: **20/20 passed** - targeted SFA CP unit tests: **3/3 passed** - warmed eager-vs-graph functional comparison: **6/6 outputs and token sequences exactly match** - tested BF16/FP16, head dimensions 96/128/160/256, both scatter dimensions, non-contiguous strides, and NaN/Inf/all-invalid LSE cases ## Known limitations - The strict matched-token logprob gate does not pass: maximum delta is `6.965e-4`, above the predeclared `atol=1e-5, rtol=1e-4`, despite exact output text and token sequences. - A longer thinking-mode comparison was classified as baseline nondeterminism because eager repeats diverged. - Final-branch DSA_CP + MTP3 accuracy coverage is still pending. Attempts did not produce a score due graph-capture compatibility failures and, in a later retry, external NPU resource contention. This is opened as a draft so the numerical acceptance threshold and remaining DSA_CP/MTP coverage can be reviewed explicitly. - vLLM main: https://github.com/vllm-project/vllm/commit/ba07e4a48fc951300d97eb506217dd530583dea3 --------- Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Q
Qiu Chunshuo committed
5c59cfba98045f49645284745be035346a4d82d8
Parent: d4fc06f
Committed by GitHub <noreply@github.com>
on 8/29/2026, 3:53:41 AM