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

cpufeatures: add support for detecting AVX-512 #862

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Conversation

tarcieri
Copy link
Member

Adds support for detecting the following features:

  • avx512f
  • avx512dq
  • avx512ifma
  • avx512pf
  • avx512er
  • avx512cd
  • avx512bw
  • avx512vl

CPUID bitflags obtained from this table:

https://en.wikichip.org/wiki/x86/avx-512#Detection

Closes #815

Adds support for detecting the following features:

- `avx512f`
- `avx512dq`
- `avx512ifma`
- `avx512pf`
- `avx512er`
- `avx512cd`
- `avx512bw`
- `avx512vl`

CPUID bitflags obtained from this table:

https://en.wikichip.org/wiki/x86/avx-512#Detection

Closes #815
@tarcieri tarcieri requested a review from newpavlov March 24, 2023 17:23
@tarcieri
Copy link
Member Author

tarcieri commented Mar 24, 2023

This is missing avx512vbmi.

I'm curious if that would be expressed as ("avx512vbmi", 1, ecx, 1)?

Edit: guess there are several more, actually:

  • avx512vbmi
  • avx512vbmi2
  • avx512vpopcntdq
  • avx512vnni
  • avx512bitalg
  • avx512bf16
  • avx512vp2intersect

@brxken128
Copy link
Contributor

brxken128 commented Mar 24, 2023

This is missing avx512vbmi.

I'm curious if that would be expressed as ("avx512vbmi", 1, ecx, 1)?

My CPU supports this flag (along with AVX512_VBMI2) - is there anything I can run/provide to help?

@tarcieri
Copy link
Member Author

@brxken128 you can make a small test script to see if it's detected

@brxken128
Copy link
Contributor

brxken128 commented Mar 24, 2023

@brxken128 you can make a small test script to see if it's detected

I temporarily altered the x86 tests, and changed the macro to search for avx512vbmi using ("avx512vbmi", 1, ecx, 1) - the tests pass so I assume they're the correct values.

Edit: I also just attempted to use ("avx512vbmi2", 1, ecx, 6) in order to detect avx512vbmi2, it was an educated guess after reading the table but the test ran without fail.

Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but it could be worth to add a note that the AVX-512 feature names may be renamed to follow potential changes in std.

@tarcieri
Copy link
Member Author

@newpavlov hmm, I'm not sure where a good place to add those is? Possibly the comment above? (which contains a link that 404s, FYI)

Will go ahead and merge this for now and leave a note about the other AVX-512 features, and maybe see about updating that comment separately and including a new link to the Intel reference guide.

@tarcieri tarcieri merged commit 1ffdfbe into master Mar 24, 2023
@tarcieri tarcieri deleted the cpufeatures/avx512 branch March 24, 2023 19:58
@newpavlov
Copy link
Member

@tarcieri
I think the note should go to the docs, otherwise it will not be visible enough. We have other unstable target features, such as the ARM ones.

@tarcieri
Copy link
Member Author

Cool, opened a documentation PR: #866

@tarcieri tarcieri mentioned this pull request Mar 25, 2023
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.

cpufeatures: requesting support for avx512 target feature
3 participants