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

x/sys/cpu: add support for detecting AVX-512 #41288

Closed
clausecker opened this issue Sep 9, 2020 · 16 comments
Closed

x/sys/cpu: add support for detecting AVX-512 #41288

clausecker opened this issue Sep 9, 2020 · 16 comments
Labels
Milestone

Comments

@clausecker
Copy link

@clausecker clausecker commented Sep 9, 2020

I would like to detect the availability of AVX-512 and its subsets (F, CD, VL, BW, DQ, IFMA, VBMI, ...) using the golang.org/x/sys/cpu package. However, no such flags are available. Please add a way to detect the availability of AVX-512 and its specific sub features. If desired, I can try writing a patch for this myself.

@gopherbot gopherbot added this to the Unreleased milestone Sep 9, 2020
@randall77
Copy link
Contributor

@randall77 randall77 commented Sep 9, 2020

A patch would be great, thanks.

@andybons andybons added the NeedsFix label Sep 10, 2020
@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 11, 2020

@fuzxxl Hi, if you will change your mind about doing it by yourself - plz ping me, I will handle this.

@clausecker
Copy link
Author

@clausecker clausecker commented Sep 11, 2020

@justplesh If you would like to do this I would be very happy. Gives me more time to spend writing my paper.

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 15, 2020

@clausecker ok, so I'll work on this

@clausecker
Copy link
Author

@clausecker clausecker commented Sep 24, 2020

@justplesh Any progress on this one?

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 24, 2020

@clausecker will start in a few days

@clausecker
Copy link
Author

@clausecker clausecker commented Sep 24, 2020

@justplesh If it's in more than week, I think I'll just do it myself. I have been holding up writing AVX-512 code for two weeks now and would like to begin soon-ish.

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 24, 2020

@clausecker I'll try this weekend

@ALTree ALTree changed the title x/sys/cpu: add support for detecting AVX-512. x/sys/cpu: add support for detecting AVX-512 Sep 24, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 27, 2020

Change https://golang.org/cl/257937 mentions this issue: cpu: add support for detecting AVX-512

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 27, 2020

@clausecker so, I've implemented the patch, hopefully, it will be merged soon

@martisch
Copy link
Contributor

@martisch martisch commented Sep 28, 2020

Note that osxsave needs to be checked and zmm register support (similar to avx and ymm registers) before allowing use of AVX-512.

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 28, 2020

Note that osxsave needs to be checked and zmm register support (similar to avx and ymm registers) before allowing use of AVX-512.

If I understood correctly, we can just check if AVX is supported. As it is already checked :)

@martisch
Copy link
Contributor

@martisch martisch commented Sep 28, 2020

The current code does not check xgetbv for zmm and opmask support which i think is needed for safe use. The avx code only checks xmm and ymm support in the os which is not sufficient to make sure the os correctly handles zmm state save and restore.

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 28, 2020

The current code does not check xgetbv for zmm and opmask support which i think is needed for safe use. The avx code only checks xmm and ymm support in the os which is not sufficient to make sure the os correctly handles zmm state save and restore.

Yep, you are right. Will handle it.

@clausecker
Copy link
Author

@clausecker clausecker commented Sep 28, 2020

Thank you for the patch! This'll be very useful.

@justplesh
Copy link
Contributor

@justplesh justplesh commented Sep 28, 2020

No problem :) Will be happy to work on the next issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.