From 951046ee1680f5e4b3d54c2cd5b9287e758d429c Mon Sep 17 00:00:00 2001 From: Hugo Meiland <32266151+hmeiland@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:04:29 +0200 Subject: [PATCH 1/2] archdetect: detect Granite Rapids via CPU model when flags match Sapphire Rapids eessi_archdetect.sh selects a microarchitecture purely from CPU feature flags. Intel Granite Rapids (Xeon 6) exposes the same visible /proc/cpuinfo flags as Sapphire/Emerald Rapids - its new features such as amx_fp16 are hidden by the kernel - so the flag match lands on x86_64/intel/sapphirerapids. Refine that match using the CPU model number, the only reliable Granite Rapids discriminator on Linux: once the flag match yields sapphirerapids, check the model and prepend x86_64/intel/graniterapids on family 6 / model 173 (0xAD, GNR-SP/AP) or 174 (0xAE, GNR-D). Non-breaking: cpupath -a returns a priority-ordered fallback chain and downstream subdir resolution selects the first path that exists, so Granite Rapids transparently falls back to sapphirerapids until a graniterapids build is shipped. Sapphire Rapids (model 143) and Emerald Rapids (model 207) are unaffected. Add a test fixture captured from a real Azure Standard_D2s_v7 (Intel Xeon 6973P-C, family 6 model 173). Verified on real Granite Rapids silicon and against the full archdetect fixture suite. Bump VERSION to 1.3.0. --- init/eessi_archdetect.sh | 20 +++++++++++++- .../Azure-Ubuntu24-6973P-C.all.output | 1 + .../Azure-Ubuntu24-6973P-C.cpuinfo | 27 +++++++++++++++++++ .../Azure-Ubuntu24-6973P-C.output | 1 + 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.all.output create mode 100644 tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.cpuinfo create mode 100644 tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.output diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 64d4131f..a3631213 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -17,7 +17,7 @@ else exit 1 fi -VERSION="1.2.0" +VERSION="1.3.0" # default log level: only emit warnings or errors LOG_LEVEL="WARN" @@ -172,6 +172,24 @@ cpupath(){ fi done + # Some Intel microarchitectures are flag-indistinguishable from an older one because their + # new features are not exposed in /proc/cpuinfo. Granite Rapids (Xeon 6) shows the exact same + # visible flags as Sapphire/Emerald Rapids (its extras like amx_fp16 are hidden by the kernel), + # so the flag match above lands on 'sapphirerapids'. Refine using the CPU model number - the + # only reliable discriminator on Linux. If no dedicated graniterapids subdir is shipped yet, + # downstream subdir resolution falls back to the next entry in the chain, so prepending is safe. + if [ "${best_arch_match}" == "x86_64/intel/sapphirerapids" ]; then + local cpu_family=$(get_cpuinfo "cpu[ _]family") + local cpu_model=$(get_cpuinfo "model") + log "DEBUG" "cpupath: refining Sapphire Rapids match (family='$cpu_family', model='$cpu_model')" + # Intel family 6 models: 173 (0xAD) = Granite Rapids-SP/AP, 174 (0xAE) = Granite Rapids-D + if [ "${cpu_family}" == "6" ] && { [ "${cpu_model}" == "173" ] || [ "${cpu_model}" == "174" ]; }; then + best_arch_match="x86_64/intel/graniterapids" + all_arch_matches="$best_arch_match:$all_arch_matches" + log "DEBUG" "cpupath: model $cpu_model identifies Granite Rapids; best match upgraded to $best_arch_match" + fi + fi + if [ "allx" == "${CPUPATH_RESULT}x" ]; then log "INFO" "cpupath: all matches for host CPU: $all_arch_matches" echo "$all_arch_matches" diff --git a/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.all.output b/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.all.output new file mode 100644 index 00000000..5b9439a3 --- /dev/null +++ b/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.all.output @@ -0,0 +1 @@ +x86_64/intel/graniterapids:x86_64/intel/sapphirerapids:x86_64/intel/icelake:x86_64/intel/cascadelake:x86_64/intel/skylake_avx512:x86_64/intel/haswell:x86_64/generic diff --git a/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.cpuinfo b/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.cpuinfo new file mode 100644 index 00000000..215ef93b --- /dev/null +++ b/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.cpuinfo @@ -0,0 +1,27 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 173 +model name : Intel(R) Xeon(R) 6973P-C +stepping : 1 +microcode : 0xffffffff +cpu MHz : 4200.428 +cache size : 491520 KB +physical id : 0 +siblings : 2 +core id : 0 +cpu cores : 1 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 36 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves user_shstk avx_vnni avx512_bf16 vnmi avx512vbmi umip waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid cldemote movdiri movdir64b fsrm serialize tsxldtrk ibt amx_bf16 avx512_fp16 amx_tile amx_int8 arch_capabilities +vmx flags : vnmi invvpid ept_x_only ept_ad ept_1gb ept_5level tsc_offset vtpr ept vpid unrestricted_guest ept_mode_based_exec tsc_scaling usr_wait_pause +bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs retbleed bhi spectre_v2_user its +bogomips : 5199.99 +clflush size : 64 +cache_alignment : 64 +address sizes : 48 bits physical, 57 bits virtual +power management: diff --git a/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.output b/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.output new file mode 100644 index 00000000..2633f463 --- /dev/null +++ b/tests/archdetect/x86_64/intel/graniterapids/Azure-Ubuntu24-6973P-C.output @@ -0,0 +1 @@ +x86_64/intel/graniterapids From 987faece8c3bd3edbd0db6d1f7d5e5f367e8bc1f Mon Sep 17 00:00:00 2001 From: Hugo Meiland <32266151+hmeiland@users.noreply.github.com> Date: Thu, 3 Sep 2026 19:28:35 +0200 Subject: [PATCH 2/2] archdetect: cite intel-family.h as authoritative source for GNR model numbers Address review feedback from @boegel: document the model-number -> microarch mapping (family 6, models 0xAD/0xAE) with its source - the kernel's arch/x86/include/asm/intel-family.h (INTEL_GRANITERAPIDS_X/_D via IFM()). --- init/eessi_archdetect.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index a3631213..1dbe6b51 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -182,7 +182,11 @@ cpupath(){ local cpu_family=$(get_cpuinfo "cpu[ _]family") local cpu_model=$(get_cpuinfo "model") log "DEBUG" "cpupath: refining Sapphire Rapids match (family='$cpu_family', model='$cpu_model')" - # Intel family 6 models: 173 (0xAD) = Granite Rapids-SP/AP, 174 (0xAE) = Granite Rapids-D + # Intel family 6 model numbers below come from the kernel's authoritative table + # arch/x86/include/asm/intel-family.h (what the kernel itself uses for model dispatch): + # INTEL_GRANITERAPIDS_X = IFM(6, 0xAD) -> family 6, model 173 (Granite Rapids-SP/AP) + # INTEL_GRANITERAPIDS_D = IFM(6, 0xAE) -> family 6, model 174 (Granite Rapids-D) + # (cf. INTEL_SAPPHIRERAPIDS_X = 0x8F/143, INTEL_EMERALDRAPIDS_X = 0xCF/207) if [ "${cpu_family}" == "6" ] && { [ "${cpu_model}" == "173" ] || [ "${cpu_model}" == "174" ]; }; then best_arch_match="x86_64/intel/graniterapids" all_arch_matches="$best_arch_match:$all_arch_matches"