perf(ds4): accelerate ROCm decode and long-context selection - #667
perf(ds4): accelerate ROCm decode and long-context selection#667davide221 wants to merge 6 commits into
Conversation
lucebox8 gfx1151 A/B (
|
| Prompt | Metric | OFF | ON | Delta |
|---|---|---|---|---|
| 32,768 | server prefill (median, n=2) | 184.56 | 191.23 tok/s | +3.62% |
| 32,768 | client decode (median, n=2) | 31.771 | 31.938 tok/s | +0.53% (noise) |
| 122,879 | server prefill | 129.46 | 133.43 tok/s | +3.07% |
| 122,879 | client decode | 26.875 | 26.540 tok/s | -1.25% (no gain) |
Correctness/integrity:
- All normal runs returned the identical expected response hash
a91b12613458d22a3fbf6d66ff2fba42124b46ea0e032f68c3564cc0c506ec43. - Captures completed with zero dropped steps, requests, or token bursts.
- 431/431 server tests and 5/5 focused profiling/GPU tests passed, including
GPU numerical equivalence forggml_moe_combine.
Matched ROCprof at 32K confirms the intended replacement: roughly 3,675 old
reduce/multiply launches disappear and 3,643 moe_combine_kernel launches are
added, saving about 1.36 s of sampled GPU work. Normal runs—not ROCprof—are the
throughput source.
Conclusion: reusable prefill win, decode-neutral. Keep this draft and
opt-in while the next gfx1151 work targets dominant quantized matmul and
grouped compact attention kernels.
|
Thank you, @davide221, for your work on Lucebox, for pushing this optimization series, and for acting on the earlier Strix Halo feedback. We qualified PR #667 head Test configuration
Matched results
The PR #667 build also fit the full 131,072-token configuration in 128 GiB. Minimum effective non-CMA headroom was 4.984 GiB. There was no OOM, GPU reset, server restart, or kernel memory-pressure event. For comparison, the stacked PR #664 base could not complete the same exact-128K fit because of a global-memory OOM. Quality findingQuality was evaluated with The previous setup stopped naturally after 1,974 generated tokens and returned For independent reproduction, our v1.5.0 release packages the exact Ansible configurations for both tested Strix Halo systems together with the benchmark definitions, pinned revisions, result data, and comparison chart. |
|
Split-KV MLA follow-up (
Retained captures:
Rejected: four-way split (repeat client deltas were only +0.17%/+0.32%) and the earlier 2-wave ROCmFP MMQ tile (+0.07%). |
Status
Draft only. This is a stacked, hardware-targeted optimization series and is not ready to merge.
Base: #664 (
codex/ds4-pflash-long-context). All full-model measurements retain DeepSeek V4 Flash's six routed experts. The historicalq=4result below means speculative verification width four, not four experts.What changed
Current-head autoregressive result
This is plain autoregressive decode: pflash/drafting off, no speculative verification, expert top-k 6, 32,767 prompt tokens, 256 output tokens, gfx1151, ROCm 7.2.
a91b1261...506ec43a91b1261...506ec43That is a measured +1.3% structural AR gain with an identical 256-token response. The specialization remains opt-in with
GGML_DS4_FA_DIRECT_TOPK_VISIBLE=1while the branch is draft.A follow-up that retained the exact-zero value envelope measured 16.00 tok/s, so the original profiled specialization was kept.
Matched LuceGraph evidence
The normal and ROCprof runs use the same input and exact response hash. Profiler throughput is not used as the performance claim.
ecae4618198a7b0ac42bda8a99b2cbe4dd803b85plus the candidatefattn.cu, byte-identical to commit2f13618.Retained captures:
/data/lucegraph-ds4-ar-ecae461-runs/baseline-ar-32k-normal/data/lucegraph-ds4-ar-ecae461-runs/baseline-ar-32k-rocprof/data/lucegraph-ds4-ar-ecae461-runs/candidate-direct-visible-ar-32k-normal/data/lucegraph-ds4-ar-ecae461-runs/candidate-direct-visible-ar-32k-rocprofThe remaining 256-token profiled round is dominated by generic dense ROCmFP4 matvec (4.525 s), routed ROCmFP2/3 mix kernels (2.909 s), indexed attention (1.760 s), and 2.414 s of non-kernel gaps. The published 38.41 tok/s Vulkan point used DSpark speculation, so it is not an AR baseline; a matched Vulkan AR-only run is still required.
Rejected current-head experiments
None of these rejected variants is included.
Historical speculative result
The earlier q=4 verification run is separate from the AR result above:
The matched 32K speculative normal capture measured 32.026 tok/s. Its ROCprof twin produced the identical response hash at 29.978 tok/s. These results predate the general adaptive-width commit; no adaptive-width speedup is claimed from them.
Adaptive speculative width
The controller starts conservatively, backs off from the exact accepted prefix after a rejection, and probes one row wider after a fully accepted block. Full acceptance is censored feedback rather than an exact sample, avoiding a narrow-width trap.
DFLASH_ADAPTIVE_SPEC_WIDTH=0restores prior fixed-width behavior.Policy reference: LaurentZuijdwijk/llama.cpp@ca26169911e8
Verification
HIP_VISIBLE_DEVICES=1:test_rocmfpx_mmqanddeepseek4_unitpass on Strix Halo.test_server_unit431/431 before the final DS4 policy-selection tweak.dflash_serverbuilds successfully on gfx1151.Running the two focused GPU tests without isolating a device currently segfaults during multi-GPU initialization on lucebox8 (R9700 + Strix); the matching Strix-only invocation passes.
Controls
GGML_DS4_FA_DIRECT_TOPK_VISIBLE=1enables the new AR attention specialization.DFLASH_ADAPTIVE_SPEC_WIDTH=0disables acceptance-feedback width adaptation globally.DFLASH_GFX1151_HC_MMVF_Q4=0opts out of the gfx1151 HC MMVF route.DFLASH_DS4_INCREMENTAL_VERIFY_MASK=0opts out of incremental mask upload.GGML_DS4_TOPK_BLOCK_RADIX=1enables the hierarchical selector.Before merge