Skip to content

Commit dd7efcf

Browse files
authored
Avoid exceeding the configured thread count in x86_64 TOBF16 (#4748)
* avoid setting nthreads higher than available
1 parent 62c33db commit dd7efcf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kernel/x86_64/tobf16.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,11 @@ void CNAME(BLASLONG n, FLOAT_TYPE * in, BLASLONG inc_in, bfloat16 * out, BLASLON
144144
if (inc_in == 0 || inc_out == 0 || n <= 100000) {
145145
nthreads = 1;
146146
} else {
147+
nthreads = num_cpu_avail(1);
147148
if (n/100000 < 100) {
148-
nthreads = 4;
149-
} else {
150-
nthreads = 16;
149+
nthreads = MAX(nthreads,4);
150+
// } else {
151+
// nthreads = MAX(nthreads,16);
151152
}
152153
}
153154

0 commit comments

Comments
 (0)