]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
ggml-cuda : add explicit casts to -INFINITY for float and half2 types
authorDaniel Bevenius <redacted>
Tue, 12 May 2026 05:59:24 +0000 (07:59 +0200)
committerGeorgi Gerganov <redacted>
Thu, 14 May 2026 18:26:48 +0000 (21:26 +0300)
This commit adds explicit casts to float for -INFINITY.

The motivation for this is that in CUDA 11.8.0, the -INFINITY macro is
defined as a double (a header provided NVCC). This triggers a warning
and hence causes a CI failure in whisper.cpp. I belive that this header
might have been updated in CUDA 12 which is why we don't see this
warning.

Refs: https://github.com/ggml-org/whisper.cpp/actions/runs/25713948217/job/75500081939?pr=3803
Refs: https://github.com/ggml-org/llama.cpp/issues/22824

ggml/src/ggml-cuda/common.cuh

index 10817505d9f0471405b4dc6766f7af268e242645..246a76193ca6b843c00f5a112c889a4b94902bf1 100644 (file)
@@ -582,9 +582,9 @@ template <typename T> struct block_reduce_policy<block_reduce_method::MAX, T> {
 
     static __device__ T sentinel() {
         if constexpr (std::is_same_v<T, float>) {
-            return -INFINITY;
+            return -(float)INFINITY;
         } else if constexpr (std::is_same_v<T, half2>) {
-            return make_half2(-INFINITY, -INFINITY);
+            return make_half2(__float2half(-(float)INFINITY), __float2half(-(float)INFINITY));
         } else {
             static_assert(ggml_cuda_dependent_false_v<T>, "Unsupported type for block reduce max");
         }