]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Allow all RDNA2 archs to use sdot4 intrinsic (#8629)
authorJeroen Mostert <redacted>
Tue, 23 Jul 2024 08:50:40 +0000 (10:50 +0200)
committerGitHub <redacted>
Tue, 23 Jul 2024 08:50:40 +0000 (10:50 +0200)
The check gating the use of `__builtin_amdgc_sdot4` specifically checks for gfx1030. This causes a severe perf regression for anything gfx103? that's not gfx1030 and not using `HSA_OVERRIDE_GFX_VERSION` (if you've built ROCm to support it). We already have a generic RDNA2 define, let's use it.

ggml/src/ggml-cuda/common.cuh

index 26d9412a23eb6f1a00054d30b9f9850d304ebdba..1c2e00c1ee42e575f197a55c7264151bf8ef459d 100644 (file)
@@ -459,7 +459,7 @@ static __device__ __forceinline__ uint32_t __hgt2_mask(const half2 a, const half
 
 static __device__ __forceinline__ int ggml_cuda_dp4a(const int a, const int b, int c) {
 #if defined(GGML_USE_HIPBLAS) && defined(__HIP_PLATFORM_AMD__)
-#if defined(__gfx906__) || defined(__gfx908__) || defined(__gfx90a__) || defined(__gfx1030__)
+#if defined(__gfx906__) || defined(__gfx908__) || defined(__gfx90a__) || defined(RDNA2)
     c = __builtin_amdgcn_sdot4(a, b, c, false);
 #elif defined(RDNA3)
     c = __builtin_amdgcn_sudot4( true, a, true, b, c, false);