Skip to content

Commit

Permalink
Weka druntime modification: disable cachesize collection (hangs on AM…
Browse files Browse the repository at this point in the history
…D genoa, and unused)

weka/druntime#3
Slightly modified cherry-pick from commit weka/druntime@0e9fbdd
  • Loading branch information
JohanEngelen committed Jul 24, 2024
1 parent e1cca7a commit cdfe437
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions runtime/druntime/src/core/cpuid.d
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,24 @@ void cpuidX86()
} else {
cf.processorName = "Unknown CPU";
}

version (WEKA)
{
// WEKA_IGNORE_BROKEN_CACHE_SIZE:
// The logic attempting to determine cache sizes and cache line sizes
// is broken for new CPUs (for example on AMD EPYC 9454). The code is not
// very sustainable, as it won't know about new CPU variants, and represents
// technical debt in any event. The only known consumer of the datacaches
// is an optimization for doing big integer math in Phobos, which we never
// use (and is only relevant for truly enormous numbers.) We just set a
// configuration which will work and matches most modern CPUs (high end low
// core counts CPUs might have larger L1, but that's ok).
datacache[0].size = 32;
datacache[0].associativity = 4;
datacache[0].lineSize = 64;
}
else
{
// Determine cache sizes

// Intel docs specify that they return 0 for 0x8000_0005.
Expand Down Expand Up @@ -966,6 +984,7 @@ void cpuidX86()
datacache[0].lineSize = 32;
}
}
}
if (cf.probablyIntel && max_cpuid >= 0x0B) {
// For Intel i7 and later, use function 0x0B to determine
// cores and hyperthreads.
Expand Down

0 comments on commit cdfe437

Please sign in to comment.