From 230b131b54e8ad4ee9086a15c69b29b387ddb3b0 Mon Sep 17 00:00:00 2001 From: Isotr0py Date: Sat, 5 Apr 2025 00:38:58 +0800 Subject: [PATCH] [Bugfix][kernels] Fix half2float conversion in gguf kernels (#15995) Signed-off-by: Isotr0py <2037008807@qq.com> --- csrc/quantization/gguf/ggml-common.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/csrc/quantization/gguf/ggml-common.h b/csrc/quantization/gguf/ggml-common.h index 99a7ea0fb277e..6bef5db3ccf15 100644 --- a/csrc/quantization/gguf/ggml-common.h +++ b/csrc/quantization/gguf/ggml-common.h @@ -1090,6 +1090,11 @@ __device__ __forceinline__ c10::BFloat16 convert_from_half(half v #endif // defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 800 } +template<> +__device__ __forceinline__ float convert_from_half(half val) { + return __half2float(val); +} + #if defined(USE_ROCM) #ifndef __has_builtin