-
-
Notifications
You must be signed in to change notification settings - Fork 308
Check the proper bit for BMI2 #1947
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
Conversation
We were actually checking for BMI1 support here. This is unlikely to have caused any issues because to date there have not been any x86 CPUs with AVX2 support but no BMI2 support.
WalkthroughUpdated x86 BMI2 feature detection in arch/x86/x86_features.c by changing the CPUID leaf 7, subleaf 0 EBX bitmask from 0x8 to 0x100, shifting the tested bit from 3 to 8. This affects has_bmi2 and any dependent feature gating. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
arch/x86/x86_features.c (1)
103-103: Clarify the BMI2 comment with exact CPUID bit to prevent future regressionsMake the comment explicit about the leaf/subleaf/bit position for quick verification.
Apply this diff:
- // check BMI2 bit + // check BMI2 bit: CPUID.(EAX=07H, ECX=0):EBX[8]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
arch/x86/x86_features.c(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
arch/x86/x86_features.c (1)
arch/x86/x86_features.h (2)
x86_cpu_features(9-26)x86_cpu_features(28-28)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (70)
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
- GitHub Check: macOS Clang ASAN (ARM64)
- GitHub Check: Windows MSVC 2022 v143 Win64 Native Instructions (AVX)
- GitHub Check: EL9 Clang S390X DFLTCC MSAN
- GitHub Check: Windows MSVC 2022 v143 Win64
- GitHub Check: Ubuntu GCC AARCH64 ASAN
- GitHub Check: Ubuntu GCC ARM HF No ARMv8 ASAN
- GitHub Check: Ubuntu GCC PPC64
🔇 Additional comments (1)
arch/x86/x86_features.c (1)
104-104: Correct BMI2 bit (EBX[8]) is now used — fix is accurateCPUID.(EAX=07H, ECX=0):EBX[8] denotes BMI2; previous 0x8 was BMI1 (EBX[3]). This aligns detection with Intel’s SDM and fixes the intended feature gate. No OSXSAVE dependency needed for BMI2.
Dead2
left a comment
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.
LGTM
We were actually checking for BMI1 support here. This is unlikely to have caused any issues because to date there have not been any x86 CPUs with AVX2 support but no BMI2 support.
Summary by CodeRabbit