From 287bc685738ff415d872823103a61cfd56cdc3ef Mon Sep 17 00:00:00 2001 From: Michael Potter Date: Sun, 12 Nov 2023 16:54:53 -0800 Subject: [PATCH] Update ggml-quants.c --- ggml-quants.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ggml-quants.c b/ggml-quants.c index 5e4da4d37..a6445b154 100644 --- a/ggml-quants.c +++ b/ggml-quants.c @@ -1273,12 +1273,12 @@ static float make_qkx2_quants(int n, int nmax, const float * restrict x, const f float max = x[0]; float sum_w = weights[0]; float sum_x = sum_w * x[0]; -+#if defined(__APPLE__) && defined(__clang_major__) && __clang_major__ >= 15 -+ // use 'volatile' to prevent unroll and work around a bug in Apple clang 15.x.x -+ for (volatile int i = 1; i < n; ++i) { -+#else - for (int i = 1; i < n; ++i) { -+#endif + #if defined(__APPLE__) && defined(__clang_major__) && __clang_major__ >= 15 + // use 'volatile' to prevent unroll and work around a bug in Apple clang 15.x.x with -O3 flag + for (volatile int i = 1; i < n; ++i) { + #else + for (int i = 1; i < n; ++i) { + #endif if (x[i] < min) min = x[i]; if (x[i] > max) max = x[i]; float w = weights[i];