Skip to content

Commit 1d1dbb4

Browse files
authored
Fix missing AMD cache info when running on a VM (#338)
Summary: Fix pytorch/pytorch#138718. This PR is verified to fix the issue and will be guarded on the PyTorch CI. When running on a VM, the AMD TopologyExtensions bit can be cleared, but that shouldn't stop us from reading the cache information.
1 parent 952a519 commit 1d1dbb4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/x86/api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ CPUINFO_INTERNAL void cpuinfo_x86_detect_topology(
105105
CPUINFO_INTERNAL void cpuinfo_x86_detect_cache(
106106
uint32_t max_base_index,
107107
uint32_t max_extended_index,
108+
/* amd_topology_extensions is not used, kept for backward compatibility */
108109
bool amd_topology_extensions,
109110
enum cpuinfo_vendor vendor,
110111
const struct cpuinfo_x86_model_info* model_info,

src/x86/cache/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void cpuinfo_x86_detect_cache(
8787
}
8888
}
8989
}
90-
if (amd_topology_extensions && max_extended_index >= UINT32_C(0x8000001D)) {
90+
if (max_extended_index >= UINT32_C(0x8000001D)) {
9191
struct cpuid_regs leaf0x8000001D;
9292
uint32_t input_ecx = 0;
9393
do {

0 commit comments

Comments
 (0)