]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
vulkan: fix 32-bit integer overflow in CEIL_DIV (#25245)
authorhokanosekai <redacted>
Mon, 6 Jul 2026 08:35:57 +0000 (10:35 +0200)
committerGitHub <redacted>
Mon, 6 Jul 2026 08:35:57 +0000 (10:35 +0200)
ggml/src/ggml-vulkan/ggml-vulkan.cpp

index c0ab9f1c6584e3ef463b135d5616ba0050012611..3e38c17ded361279e2b6991fefb2a32cbbcc7530 100644 (file)
@@ -129,7 +129,7 @@ typedef struct VkPhysicalDeviceShaderMixedFloatDotProductFeaturesVALVE {
 #endif
 
 #define ROUNDUP_POW2(M, N) (((M) + (N) - 1) & ~((N) - 1))
-#define CEIL_DIV(M, N) (((M) + (N)-1) / (N))
+#define CEIL_DIV(M, N) (((M) / (N)) + (((M) % (N)) != 0))
 static bool is_pow2(uint32_t x) { return x > 1 && (x & (x-1)) == 0; }
 
 #define VK_VENDOR_ID_AMD 0x1002