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 1/2] =?UTF-8?q?use=20pause=20asm=20insn=20in=20busyloop=20?= =?UTF-8?q?to=20run=20the=20CPU=20(13600K)=2010=20=C2=B0C=20cooler=20(#131?= =?UTF-8?q?4)?= 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 From e6a46b0ed1884c77267dc70693183e3b7164e0e0 Mon Sep 17 00:00:00 2001 From: DannyDaemonic Date: Tue, 9 May 2023 10:53:28 -0700 Subject: [PATCH 2/2] Locale fix for Windows (#1379) --- examples/common.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/common.cpp b/examples/common.cpp index 23d69e7d5..7aa77587b 100644 --- a/examples/common.cpp +++ b/examples/common.cpp @@ -520,8 +520,9 @@ void console_init(console_state & con_st) { if (con_st.tty != nullptr) { con_st.out = con_st.tty; } -#endif + setlocale(LC_ALL, ""); +#endif } void console_cleanup(console_state & con_st) {