From 458aeb10e91492e849432ebe28466ed1cda9a0cf Mon Sep 17 00:00:00 2001 From: Sami Farin Date: Thu, 4 May 2023 13:51:29 +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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested with a 13B model. --- ggml.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ggml.c b/ggml.c index 0bcb5f617..775b3506d 100644 --- a/ggml.c +++ b/ggml.c @@ -11656,7 +11656,14 @@ typedef int ggml_lock_t; #define ggml_lock_init(x) UNUSED(x) #define ggml_lock_destroy(x) UNUSED(x) +#ifdef __x86_64__ +static inline void ggml_lock_lock(void* x); +inline void ggml_lock_lock(void* x) { + __asm__ __volatile__("pause\n"); +} +#else #define ggml_lock_lock(x) UNUSED(x) +#endif #define ggml_lock_unlock(x) UNUSED(x) #define GGML_LOCK_INITIALIZER 0