Skip to content
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

core:sys/info AVX-512 CPU Features #4376

Merged
merged 4 commits into from
Oct 16, 2024
Merged

Conversation

Barinzaya
Copy link
Contributor

@Barinzaya Barinzaya commented Oct 14, 2024

Adds AVX-512 feature detection to core:sys/info.

Per a discussion in #package-dev in the Discord server, this adds each individual feature flag of AVX-512 (16 total) as individual entries in CPU_Feature, for a current total of 34 CPU_Feature values. 4FMAPS and 4VNNIW are excluded, as they don't have corresponding LLVM target features.

XCR0 bits to check were sourced from the Intel Software Developer Manual, volume 1, section 15.2.

CPUID feature flag bits were sourced from the Intel Instruction Set Extensions document, section 1.4, table 1-3.

Note that there is an apparently an issue where this detection may report a false negative on Darwin systems; see a GitHub issue on the Go compiler. This issue is not addressed by these changes.

@laytan
Copy link
Collaborator

laytan commented Oct 15, 2024

What do you think of making it for example avx512bw instead of avx512_bw so they are equivalent to the LLVM naming used for @(enable_target_features) and the likes?

@Barinzaya
Copy link
Contributor Author

What do you think of making it for example avx512bw instead of avx512_bw so they are equivalent to the LLVM naming used for @(enable_target_features) and the likes?

I think the only reason I didn't do that is because of the ones that start with a number, where the numbers run together (e.g. avx5124fmaps). In retrospect though, that's not a big deal and I think you're right that making them match the LLVM target features makes more sense. Will make the change.

@Barinzaya
Copy link
Contributor Author

Barinzaya commented Oct 15, 2024

Looking at it with that in mind, it seems like LLVM doesn't even have target features for those two (4FMAPS and 4VNNIW). In that case I think I'll actually just remove them. They were only ever on one Intel CPU anyway (Knight's Mill).

Removed underscores from the AVX-512 names in `CPU_Feature` to make them match their equivalent LLVM target features. Removed 4FMAPs and 4VNNIW as there aren't matching LLVM target features.
@laytan laytan merged commit 2141299 into odin-lang:master Oct 16, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants