-
Notifications
You must be signed in to change notification settings - Fork 53
fix: add CPU detection for Intel Emerald Rapids and newer processors #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: openblas
Are you sure you want to change the base?
fix: add CPU detection for Intel Emerald Rapids and newer processors #373
Conversation
Problem: Intel Xeon Platinum 8575C (Emerald Rapids, model 207 = exmodel 12, model 15) was incorrectly detected as PRESCOTT (Pentium 4 era) instead of SAPPHIRERAPIDS. Root cause: 1. In get_corename() function, case 12 (exmodel 12) only handled model 6 (Arrow Lake) but missed model 15 (Emerald Rapids) 2. Missing break statement caused fall-through to case 15 (family 15, which is Pentium 4), returning CORE_PRESCOTT incorrectly Changes: - cpuid_x86.c: Add case 15 (Emerald Rapids) to exmodel 12 switch and add missing break statement - dynamic.c: Add case 12 with model 15 for runtime detection of Emerald Rapids processors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
d0f036b to
9f7497f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes CPU detection for Intel Emerald Rapids processors (e.g., Intel Xeon Platinum 8575C) which were incorrectly identified as PRESCOTT (Pentium 4 era) due to a missing break statement and incomplete model handling. The fix adds proper detection for Emerald Rapids and other recent Intel processors.
Changes:
- Added Emerald Rapids (model 15) detection in exmodel 12 case
- Fixed missing break statement after exmodel 12 to prevent fall-through to family 15 (Pentium 4)
- Added runtime detection for exmodel 10-12 processors (Meteor Lake, Granite Rapids, Raptor Lake, Alder Lake N, Arrow Lake, Emerald Rapids)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cpuid_x86.c | Adds case 15 for Emerald Rapids detection and critical break statement to prevent fall-through |
| driver/others/dynamic.c | Adds runtime detection for exmodel 10, 11, and 12 Intel processors with appropriate fallback logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return NULL; | ||
| case 12: | ||
| // Emerald Rapids (e.g., Intel Xeon Platinum 8575C, model 207 = exmodel 12, model 15) | ||
| if (model == 15) { | ||
| if(support_amx_bf16()) | ||
| return &gotoblas_SAPPHIRERAPIDS; | ||
| if(support_avx512_bf16()) | ||
| return &gotoblas_COOPERLAKE; | ||
| if (support_avx512()) | ||
| return &gotoblas_SKYLAKEX; | ||
| if(support_avx2()) |
Copilot
AI
Jan 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model 10 (Meteor Lake) is handled redundantly. It's already included in the check at line 794 (model == 7 || model == 0), but this separate check for model == 10 at line 807 has different behavior - it doesn't check for AVX512 support like line 795 does. This could lead to suboptimal kernel selection for Meteor Lake processors with AVX512 support. Consider removing this redundant check or consolidating the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| case 12: | ||
| // Emerald Rapids (e.g., Intel Xeon Platinum 8575C, model 207 = exmodel 12, model 15) | ||
| if (model == 15) { | ||
| if(support_amx_bf16()) | ||
| return &gotoblas_SAPPHIRERAPIDS; | ||
| if(support_avx512_bf16()) | ||
| return &gotoblas_COOPERLAKE; | ||
| if (support_avx512()) | ||
| return &gotoblas_SKYLAKEX; | ||
| if(support_avx2()) | ||
| return &gotoblas_HASWELL; | ||
| if(support_avx()) { | ||
| openblas_warning(FALLBACK_VERBOSE, SANDYBRIDGE_FALLBACK); | ||
| return &gotoblas_SANDYBRIDGE; | ||
| } else { | ||
| openblas_warning(FALLBACK_VERBOSE, NEHALEM_FALLBACK); | ||
| return &gotoblas_NEHALEM; | ||
| } | ||
| } |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case 12 implementation only handles model 15 (Emerald Rapids) but the corresponding cpuid_x86.c code also handles model 6 (Arrow Lake). The runtime detection should also include a check for model 6 to maintain consistency with the compile-time detection logic.
| if(support_amx_bf16()) | ||
| return &gotoblas_SAPPHIRERAPIDS; | ||
| if(support_avx512_bf16()) | ||
| return &gotoblas_COOPERLAKE; | ||
| if (support_avx512()) | ||
| return &gotoblas_SKYLAKEX; | ||
| if(support_avx2()) | ||
| return &gotoblas_HASWELL; | ||
| if(support_avx()) { | ||
| openblas_warning(FALLBACK_VERBOSE, SANDYBRIDGE_FALLBACK); | ||
| return &gotoblas_SANDYBRIDGE; | ||
| } else { | ||
| openblas_warning(FALLBACK_VERBOSE, NEHALEM_FALLBACK); | ||
| return &gotoblas_NEHALEM; | ||
| } |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block (lines 811-825) is duplicated from case 8, model 15 (lines 734-747). The identical fallback logic appears in multiple places throughout this file. Consider extracting this common detection logic into a helper function to improve maintainability and reduce code duplication.
Summary
Fix incorrect CPU detection for Intel Emerald Rapids processors (e.g., Intel Xeon Platinum 8575C) where they were misidentified as PRESCOTT (Pentium 4 era) instead of SAPPHIRERAPIDS.
Problem:
CORE=PRESCOTTalways_inline function '_mm256_fmadd_ps' requires target feature 'fma'Root Cause:
get_corename()incpuid_x86.c: case 12 (exmodel 12) only handled model 6 (Arrow Lake), missing model 15 (Emerald Rapids)breakstatement caused fall-through to case 15 (family 15 = Pentium 4), returningCORE_PRESCOTTdynamic.clacked runtime detection support for exmodel 10-12 newer Intel processorsChanges:
cpuid_x86.c: Add case 15 (Emerald Rapids) to exmodel 12 switch + add missing breakdriver/others/dynamic.c: Add runtime detection for:Test plan