Commit e087c6c4e for llama.cpp
commit e087c6c4e7bf6b773a6d3cf6c5bdd41fa6d9e2c1
Author: Sv. Lockal <AngryLoki@users.noreply.github.com>
Date: Fri Nov 27 04:36:34 2026 +0800
hip : fix bf16 MFMA operand vector type for CDNA (#33086)
Follow-up to ggml-org/llama.cpp#30885: the CDNA MFMA bf16 builtins
also take short vectors, so LLVM 23 rejects __bf16 for gfx908, gfx90a,
gfx942 and gfx950.
diff --git a/ggml/src/ggml-cuda/mma.cuh b/ggml/src/ggml-cuda/mma.cuh
index 325cb9306..7a27624b9 100644
--- a/ggml/src/ggml-cuda/mma.cuh
+++ b/ggml/src/ggml-cuda/mma.cuh
@@ -1430,14 +1430,14 @@ namespace ggml_cuda_mma {
using floatx4_t = __attribute__((ext_vector_type(4))) float;
floatx4_t& acc_frag = reinterpret_cast<floatx4_t&>(D.x[0]);
#if defined(CDNA4) || defined(CDNA3) || defined(CDNA2)
- using bf16x4_t = __attribute__((ext_vector_type(4))) __bf16;
+ using bf16x4_t = __attribute__((ext_vector_type(4))) short;
const bf16x4_t& a_frag = reinterpret_cast<const bf16x4_t&>(A.x[0]);
const bf16x4_t& b_frag = reinterpret_cast<const bf16x4_t&>(B.x[0]);
acc_frag = __builtin_amdgcn_mfma_f32_16x16x16bf16_1k(a_frag, b_frag, acc_frag, 0, 0, 0);
#elif defined(CDNA1)
#pragma unroll
for (int i = 0; i < 2; ++i) {
- using bf16x2_t = __attribute__((ext_vector_type(2))) __bf16;
+ using bf16x2_t = __attribute__((ext_vector_type(2))) short;
const bf16x2_t& a_frag = reinterpret_cast<const bf16x2_t&>(A.x[i]);
const bf16x2_t& b_frag = reinterpret_cast<const bf16x2_t&>(B.x[i]);
acc_frag = __builtin_amdgcn_mfma_f32_16x16x8bf16(a_frag, b_frag, acc_frag, 0, 0, 0);