]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
threads: fix msvc build without openmp (llama/9615)
authorMax Krasnyansky <redacted>
Tue, 24 Sep 2024 04:18:48 +0000 (21:18 -0700)
committerGeorgi Gerganov <redacted>
Tue, 24 Sep 2024 10:04:37 +0000 (13:04 +0300)
We're missing atomic_thread_fence() in MSVC builds when openmp is disabled.

src/ggml.c

index 4c55d801495322fcf412a89a74c79825c775dc5c..4b782b0c13550f22c8e94aa6567927dd4e552ae1 100644 (file)
@@ -135,6 +135,9 @@ static atomic_bool atomic_flag_test_and_set(atomic_flag * ptr) {
 static void atomic_flag_clear(atomic_flag * ptr) {
     InterlockedExchange(ptr, 0);
 }
+static void atomic_thread_fence(memory_order mo) {
+    MemoryBarrier();
+}
 #else // clang
 #include <stdatomic.h>
 #endif