golang/go

internal/cpu: should detect AVX512

Closed this issue · 8 comments

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.11beta2

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

darwin amd64

What did you do?

I want to run AVX512 instructions after detect cpu feature ( go1.11 have AVX512 instructions in anames.go)

What did you expect to see?

internal/cpu tells me whether I have AVX512 support or not

What did you see instead?

nothing about AVX512 there

I have wrote codes about detect AVX512, maybe should I contribute it?

CC: @randall77 @tklauser @aead

Do you mean x/sys/cpu instead of internal/cpu? (If this is for something internal to the runtime or standard library, please include a cross-reference to whatever issue it's for.)

I mean internal/cpu

for example:

in crypto/sha1/sha1block_amd64.go line:15:
var useAVX2 = cpu.X86.HasAVX2 && cpu.X86.HasBMI1 && cpu.X86.HasBMI2

how about add HasAVX512 under X86?

HasAVX512 is only useful in internal/cpu if something else in the standard library is going to use it: nothing else is allowed to import internal/cpu or depend on its contents.

What specific changes in the standard library do you want to use it in?

(CC @FiloSottile for crypto/)

like xor in crypto/cipher

If we decide that such a change is worthwhile, presumably we would add the corresponding support to internal/cpu at the same time (for the same issue or even in the same CL).

I don't think we should add to internal/cpu without a concrete change we're going to use it in.

that make sense, thank you for your reply

Ok. I'll close this for now, but it's certainly something we can consider when we have a concrete use for it.