Skip to content

Commit 6f71c0f

Browse files
authored
Return a somewhat sane default value for L2 cache size if cpuid retur… (#1611)
* Return a somewhat sane default value for L2 cache size if cpuid returned something unexpected Fixes #1610, the KVM hypervisor on Google Chromebooks returning zero for CPUID 0x80000006, causing DYNAMIC_ARCH builds of OpenBLAS to hang
1 parent 3313e4b commit 6f71c0f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

kernel/setparam-ref.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,9 @@ static int get_l2_size_old(void){
647647
return 6144;
648648
}
649649
}
650-
return 0;
650+
// return 0;
651+
fprintf (stderr,"OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k\n");
652+
return 256;
651653
}
652654
#endif
653655

@@ -660,6 +662,10 @@ static __inline__ int get_l2_size(void){
660662
l2 = BITMASK(ecx, 16, 0xffff);
661663

662664
#ifndef ARCH_X86
665+
if (l2 <= 0) {
666+
fprintf (stderr,"OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k\n");
667+
return 256;
668+
}
663669
return l2;
664670

665671
#else

0 commit comments

Comments
 (0)