[tests] Add check for X86Base.IsSupported before calling X86Base.CpuId#126476
Open
BrzVlad wants to merge 2 commits intodotnet:mainfrom
Open
[tests] Add check for X86Base.IsSupported before calling X86Base.CpuId#126476BrzVlad wants to merge 2 commits intodotnet:mainfrom
BrzVlad wants to merge 2 commits intodotnet:mainfrom
Conversation
This test was falling on interpreter with PlatformNotSupportedException
Contributor
|
Tagging subscribers to this area: @BrzVlad, @janvorli, @kg |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates an AVX-512 BMM hardware intrinsics test to avoid PlatformNotSupportedException when running under an interpreter by ensuring X86Base.CpuId is only called when X86Base is supported.
Changes:
- Added an
X86Base.IsSupportedearly-return guard before callingX86Base.CpuIdinCheckSupported().
src/tests/JIT/HardwareIntrinsics/X86_Avx512/Avx512Bmm/HandwrittenProgram.cs
Outdated
Show resolved
Hide resolved
…tenProgram.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment on lines
+102
to
106
| if (!X86Base.IsSupported) return; | ||
|
|
||
| (int Eax, int Ebx, int Ecx, int Edx) = X86Base.CpuId(unchecked((int)0x80000021), (int)0x0); | ||
| bool isSupported = (Eax & (1 << 23)) != 0; | ||
| Assert.Equal(isSupported, Avx512Bmm.IsSupported); |
There was a problem hiding this comment.
Returning early when X86Base isn’t supported avoids the exception, but it also means this [Fact] no longer asserts anything in that scenario (it will pass even if Avx512Bmm.IsSupported were unexpectedly true). Consider asserting Avx512Bmm.IsSupported is false when X86Base.IsSupported is false, and only doing the CpuId-based check in the supported case.
tannergooding
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This test was falling on interpreter with PlatformNotSupportedException