Fix Avx10 detection: cache CPUID bit before later queries overwrite cpuidInfo#126810
Open
Fix Avx10 detection: cache CPUID bit before later queries overwrite cpuidInfo#126810
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
…overwrite cpuidInfo The check for `(cpuidInfo[CPUID_EDX] & (1 << 19)) != 0` was being performed after a `__cpuidex(cpuidInfo, 0x80000021, 0x0)` call overwrote `cpuidInfo`, causing the AVX10 bit check to read from the wrong CPUID leaf data. Move the AVX10 bit check into the leaf 7 sub-leaf 1 block alongside the AVX512-BF16 dependency check, and use the cached `hasAvx10v1Dependencies` bool in the `maxCpuId >= 0x24` section instead. Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/e73ed6c1-2b7b-4488-a920-6366304b4a23 Co-authored-by: tannergooding <10487869+tannergooding@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AVX10 detection issue due to recent changes in cpufeature.c
Fix Avx10 detection: cache CPUID bit before later queries overwrite cpuidInfo
Apr 12, 2026
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/8a5289fa-3d31-43dd-a577-b39ffeb8368e Co-authored-by: tannergooding <10487869+tannergooding@users.noreply.github.com>
tannergooding
approved these changes
Apr 12, 2026
Member
|
Small fix to ensure AVX10v1 detection is still handled as expected. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes AVX10 feature detection in minipal_getcpufeatures by ensuring the AVX10 CPUID bit is checked/cached while leaf 7 sub-leaf 1 data is still valid, instead of reading cpuidInfo after it has been overwritten by a later CPUID query.
Changes:
- Cache the AVX10 CPUID presence bit (leaf 7, sub-leaf 1, EDX[19]) alongside the existing AVX10 dependency checks while the correct
cpuidInfois live. - Gate the later AVX10 version detection (leaf 0x24) on the cached
hasAvx10v1Dependenciesboolean instead of re-readingcpuidInfo. - Remove a redundant
hasAvx10v1Dependenciescondition inside the leaf 0x24 version checks.
EgorBo
approved these changes
Apr 12, 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.
Description
The AVX10 CPUID bit check (
cpuidInfo[CPUID_EDX] & (1 << 19)) was reading stale data. The check at L432 expected leaf 7 sub-leaf 1 results (loaded at L380), butcpuidInfohad been overwritten by__cpuidex(cpuidInfo, 0x80000021, 0x0)at L423.Changes:
cpuidInfostill holds the correct datamaxCpuId >= 0x24with the cachedhasAvx10v1Dependenciesbool — matching the established pattern used forhasAvx2DependenciesandhasApxDependencieshasAvx10v1Dependenciescheck from the AVX10 version detection block (already guarded by the outerif), and move the dependency comment to the outer guard withAvx10appended at the end