From dd7efcf9efe836fedd49cffb6293d1e9a791be54 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Fri, 14 Jun 2024 14:21:13 +0200 Subject: [PATCH] Avoid exceeding the configured thread count in x86_64 TOBF16 (#4748) * avoid setting nthreads higher than available --- kernel/x86_64/tobf16.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/x86_64/tobf16.c b/kernel/x86_64/tobf16.c index a88fdcc2e..e8e228955 100644 --- a/kernel/x86_64/tobf16.c +++ b/kernel/x86_64/tobf16.c @@ -144,10 +144,11 @@ void CNAME(BLASLONG n, FLOAT_TYPE * in, BLASLONG inc_in, bfloat16 * out, BLASLON if (inc_in == 0 || inc_out == 0 || n <= 100000) { nthreads = 1; } else { + nthreads = num_cpu_avail(1); if (n/100000 < 100) { - nthreads = 4; - } else { - nthreads = 16; + nthreads = MAX(nthreads,4); +// } else { +// nthreads = MAX(nthreads,16); } }