Avoid exceeding the configured thread count in x86_64 TOBF16 (#4748)

* avoid setting nthreads higher than available
This commit is contained in:
Martin Kroeker 2024-06-14 14:21:13 +02:00 committed by GitHub
parent 62c33db37d
commit dd7efcf9ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -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);
}
}