perf(ds4): accelerate ROCmFPx dual-GPU serving - #604
Conversation
Add qualified affine ROCmFP2 kernels, grouped expert MMVQ, phase-aware heterogeneous placement, bounded long-context prefill scratch, and reproducible 128K launch and benchmark tooling.
There was a problem hiding this comment.
2 issues found across 29 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="server/deps/llama.cpp/ggml/src/ggml-cuda/mmq.cu">
<violation number="1" location="server/deps/llama.cpp/ggml/src/ggml-cuda/mmq.cu:513">
P2: When a split tensor spans the qualified device and another GPU, this owner filter disables MMQ for the entire operation because callers AND all device results into one `use_mul_mat_q` flag. Apply the qualification at per-device launch/placement rather than this global capability predicate, or explicitly handle split tensors so the matching owner can still use MMQ.</violation>
</file>
<file name="server/deps/llama.cpp/ggml/src/ggml-cuda/vecdotq.cuh">
<violation number="1" location="server/deps/llama.cpp/ggml/src/ggml-cuda/vecdotq.cuh:534">
P3: The affine offset-correction math (`sumq` extraction and the `scale*sumi + (scale-offset)*sumq` formula) is copied verbatim across `vecdotq.cuh` and `mmvq.cu` (and re-derived in the MMQ loader). A future change to the affine wire format must be mirrored in each copy or the kernels silently disagree. Factor the sumq/offset formula into a shared helper to keep the MMVQ paths consistent.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| // affine dot is scale*sum(c*q) - offset*sum(q) = scale*sumi + (scale-offset)*sumq. | ||
| const float scale = rocmfpx_ue4m3_to_fp32_finite(bq2->e[0]); | ||
| const float offset = rocmfpx_ue4m3_to_fp32_finite(bq2->e[1]); | ||
| int sumq = 0; |
There was a problem hiding this comment.
P3: The affine offset-correction math (sumq extraction and the scale*sumi + (scale-offset)*sumq formula) is copied verbatim across vecdotq.cuh and mmvq.cu (and re-derived in the MMQ loader). A future change to the affine wire format must be mirrored in each copy or the kernels silently disagree. Factor the sumq/offset formula into a shared helper to keep the MMVQ paths consistent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At server/deps/llama.cpp/ggml/src/ggml-cuda/vecdotq.cuh, line 534:
<comment>The affine offset-correction math (`sumq` extraction and the `scale*sumi + (scale-offset)*sumq` formula) is copied verbatim across `vecdotq.cuh` and `mmvq.cu` (and re-derived in the MMQ loader). A future change to the affine wire format must be mirrored in each copy or the kernels silently disagree. Factor the sumq/offset formula into a shared helper to keep the MMVQ paths consistent.</comment>
<file context>
@@ -525,7 +525,23 @@ static __device__ __forceinline__ float vec_dot_rocmfpx_fp2_q8_1(
+ // affine dot is scale*sum(c*q) - offset*sum(q) = scale*sumi + (scale-offset)*sumq.
+ const float scale = rocmfpx_ue4m3_to_fp32_finite(bq2->e[0]);
+ const float offset = rocmfpx_ue4m3_to_fp32_finite(bq2->e[1]);
+ int sumq = 0;
+#pragma unroll
+ for (int j = 0; j < 4; ++j) {
</file context>
There was a problem hiding this comment.
Valid. Fixed in 96fbda3: the affine sumq extraction and correction formula now live in one device helper shared by generic and packed MMVQ. The MMQ path performs per-lane affine value decoding rather than duplicating this dot-reduction formula.
|
Post-cleanup live verification at commit
This confirms the |
There was a problem hiding this comment.
All reported issues were addressed across 15 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Summary
max_completion_tokensas the server defaultQualified results
Hardware: Radeon RX 7900 XT + Ryzen AI Max+ 395, true top-k-6, fixed DSpark q=4, 135,168 context slots, no prefix/prefill cache.
Older top-k-4 sparse-prefill records are documented separately and are not presented as equivalent launch settings. Adaptive qtype-105/106 expert tensors remain monolithic-only; the dual-GPU profile targets uniform or fixed-codebook tensors.
Verification
dflash_server,test_rocmfpx_mmq,test_server_unit,test_deepseek4_unit, andtest_deepseek4_mmid_grouped_cudactest --test-dir server/build-rocmfpx-pr --output-on-failure -j8— 377/377 passedtest_rocmfpx_mmqandtest_deepseek4_mmid_grouped_cudapassed onHIP_VISIBLE_DEVICES=0and1; grouped parity covered 70 compared cases and 2,236,416 compared bytes per devicegit diff --check HEAD^passed