From 9f8dbc4787f32cd9c13b5c647d497d13c1a06db2 Mon Sep 17 00:00:00 2001 From: Sami Farin <3876865+Safari77@users.noreply.github.com> Date: Tue, 9 May 2023 15:29:20 +0300 Subject: [PATCH] =?UTF-8?q?use=20pause=20asm=20insn=20in=20busyloop=20to?= =?UTF-8?q?=20run=20the=20CPU=20(13600K)=2010=20=C2=B0C=20cooler=20(#1314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * use pause asm insn in busyloop to run the CPU (13600K) 10 °C cooler Tested with a 13B model. * use _mm_pause() in busyloop * use _mm_pause() in busyloop on x86_64 to reduce power consumption --- ggml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ggml.c b/ggml.c index 1b89bdd89..4e309df8a 100644 --- a/ggml.c +++ b/ggml.c @@ -11663,7 +11663,11 @@ typedef int ggml_lock_t; #define ggml_lock_init(x) UNUSED(x) #define ggml_lock_destroy(x) UNUSED(x) +#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_M_AMD64)) +#define ggml_lock_lock(x) _mm_pause() +#else #define ggml_lock_lock(x) UNUSED(x) +#endif #define ggml_lock_unlock(x) UNUSED(x) #define GGML_LOCK_INITIALIZER 0