File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -391,7 +391,15 @@ static void numa_mapping(void) {
391
391
core = 0 ;
392
392
for (cpu = 0 ; cpu < common -> num_procs ; cpu ++ ) {
393
393
bitmask_idx = CPUELT (cpu );
394
+ /*
395
+ * When common->avail[i] = 0x5555555555555555UL (indicating that adjacent logical cores share a physical core),
396
+ * using it as a mask may overlap with the local_cpu_map function's role, leading to only half of the real physical cores being detected.
397
+ */
398
+ #ifdef ARCH_LOONGARCH64
399
+ if (common -> node_info [node ][bitmask_idx ]) {
400
+ #else
394
401
if (common -> node_info [node ][bitmask_idx ] & common -> avail [bitmask_idx ] & CPUMASK (cpu )) {
402
+ #endif
395
403
common -> cpu_info [count ] = WRITE_CORE (core ) | WRITE_NODE (node ) | WRITE_CPU (cpu );
396
404
count ++ ;
397
405
core ++ ;
@@ -930,8 +938,12 @@ void gotoblas_affinity_init(void) {
930
938
931
939
if (common -> num_nodes > 1 ) numa_mapping ();
932
940
941
+ #ifdef ARCH_LOONGARCH64
942
+ common -> final_num_procs = common -> num_procs ;
943
+ #else
933
944
common -> final_num_procs = 0 ;
934
945
for (i = 0 ; i < common -> avail_count ; i ++ ) common -> final_num_procs += rcount (common -> avail [i ]) + 1 ; //Make the max cpu number.
946
+ #endif
935
947
936
948
for (cpu = 0 ; cpu < common -> final_num_procs ; cpu ++ ) common -> cpu_use [cpu ] = 0 ;
937
949
You can’t perform that action at this time.
0 commit comments