]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
HIP: use hipBLAS for dense prefill on gfx900, keep MMQ for MoE (#24588)
authorzduford <redacted>
Tue, 30 Jun 2026 09:51:38 +0000 (05:51 -0400)
committerGitHub <redacted>
Tue, 30 Jun 2026 09:51:38 +0000 (11:51 +0200)
* HIP: keep MMQ for gfx900 MoE and Q8_0, use hipBLAS for dense K-quants

Assisted-by: GitHub Copilot CLI
* HIP: tighten conditional block to be explicitly for gfx900

* HIP: Further simplified gfx900 conditional block

* removed unnecessary comment

ggml/src/ggml-cuda/mmq.cu

index e1add5e0331609d3349a8d2df4427cc2914df375..6b3b0d064a5558997a0b21a3083f631dc10f087f 100644 (file)
@@ -368,5 +368,12 @@ bool ggml_cuda_should_use_mmq(enum ggml_type type, int cc, int64_t ne11, int64_t
         return true;
     }
 
+    // gfx900 (Vega 10) lacks native dp4a, loses to dequant + hipBLAS
+    // for dense matrices; keep MMQ only for MoE, where the
+    // hipBLAS path is much slower.
+    if (cc == GGML_CUDA_CC_VEGA) {
+        return n_experts > 0;
+    }
+
     return (!GGML_CUDA_CC_IS_CDNA(cc)) || ne11 < MMQ_DP4A_MAX_BATCH_SIZE;
 }