Live data from Hacker News

Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

github.com

11–20 of 36 posts

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#11
A recent blog post by Vlad Krasnov, author of a bunch of the crypto assembly code in openssl and in golang, about frequency scaling when using AVX-512 making it not worth it: https://blog.cloudflare.com/on-the-dangers-of-intels-frequen...

He doesn't like the title of the OP and provided links:

> Very misleading title. Could just as well name it "accelerate sha256 up to 134x". You need to compare apples to apples. If AVX2 was used in the same way AVX512 is used, the speedup would be 2X at most. Reminds me of two of my papers https://eprint.iacr.org/2012/371.pdf https://eprint.iacr.org/2012/067.pdf

(from https://twitter.com/thecomp1ler/status/940724783804645376)

EDIT: Thanks 'delhanty !

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#12
post #8

This is assembly, not pure Go, but it doesn't use CGO which I probably what they mean. Intel Cannon Lake processors will support the SHA instruction extensions (currently available only on Goldmont). It will be interesting to see how that compares with this approach of running 16 SHA computations in parallel. You would be able to get rid of the scheduling overhead of having to first queue up 16 SHA calculations from…

This is assembly, not pure Go Well, if you're going to dip into pedantic mode, couldn't the language maintainers just define Go to include a few relevant Assembly instruction sets? (Not taking a dig at you but rather at the above level of pendantry.)

Not without tying Go to one architecture, no.

When C programmers write inline assembly, they don't pretend it's C code.

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#13

Earlier quoted context omitted.

This is assembly, not pure Go Well, if you're going to dip into pedantic mode, couldn't the language maintainers just define Go to include a few relevant Assembly instruction sets? (Not taking a dig at you but rather at the above level of pendantry.)

Not without tying Go to one architecture, no. When C programmers write inline assembly, they don't pretend it's C code.

Go has it's own form of assembly which it compiles to multiple architectures.

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#14

One thing to note is that the benchmark is running on a Skylake Platinum chip which has two AVX512 FMAs. You need a Gold 6000 series and above to see any benefit from AVX512. In most other cases the CPU throttles down some insane amount and there’s no to little benefit.

In this particular AVX512 use case or in most?

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#15

A recent blog post by Vlad Krasnov, author of a bunch of the crypto assembly code in openssl and in golang, about frequency scaling when using AVX-512 making it not worth it: https://blog.cloudflare.com/on-the-dangers-of-intels-frequen... He doesn't like the title of the OP and provided links: > Very misleading title. Could just as well name it "accelerate sha256 up to 134x". You need to compare apples to apples. If…

The twitter link needs fixing perhaps:

https://twitter.com/thecomp1ler/status/940724783804645376

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#16

Earlier quoted context omitted.

This is assembly, not pure Go Well, if you're going to dip into pedantic mode, couldn't the language maintainers just define Go to include a few relevant Assembly instruction sets? (Not taking a dig at you but rather at the above level of pendantry.)

Not without tying Go to one architecture, no. When C programmers write inline assembly, they don't pretend it's C code.

Sure they do, most developers are even't aware that ANSI C does not define any kind of inline Assembly, and ANSI C++ only defines the existance of an asm keyword with implementation defined behavior.

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#17

Earlier quoted context omitted.

Not without tying Go to one architecture, no. When C programmers write inline assembly, they don't pretend it's C code.

Go has it's own form of assembly which it compiles to multiple architectures.

This is interesting. A citation that helps strengthen the explanation:

https://golang.org/doc/asm

"The most important thing to know about Go's assembler is that it is not a direct representation of the underlying machine. Some of the details map precisely to the machine, but some do not... The details vary with architecture, and we apologize for the imprecision; the situation is not well-defined."

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#18

Earlier quoted context omitted.

This is assembly, not pure Go Well, if you're going to dip into pedantic mode, couldn't the language maintainers just define Go to include a few relevant Assembly instruction sets? (Not taking a dig at you but rather at the above level of pendantry.)

Not without tying Go to one architecture, no. When C programmers write inline assembly, they don't pretend it's C code.

Not without tying Go to one architecture, no.

Not trying hard enough to prove the null hypothesis. If you're going full pedantic mode, why stop at one ISA? Just throw in the most relevant dozen. (Heck, I even spelled that out!)

Re: Show HN: Accelerate SHA256 Computations in Go Using AVX512 instructions

#20
post #8

This is assembly, not pure Go, but it doesn't use CGO which I probably what they mean. Intel Cannon Lake processors will support the SHA instruction extensions (currently available only on Goldmont). It will be interesting to see how that compares with this approach of running 16 SHA computations in parallel. You would be able to get rid of the scheduling overhead of having to first queue up 16 SHA calculations from…

> Intel Cannon Lake processors will support the SHA instruction extensions (currently available only on Goldmont)

They're also already available on AMD Zen (Ryzen, Threadripper, Epyc, Ryzen Mobile).

Post reply on HN