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

all: avx-512 #163

Closed
wants to merge 58 commits into from
Closed

all: avx-512 #163

wants to merge 58 commits into from

Conversation

mmcloughlin
Copy link
Owner

Work in progress towards AVX-512 support.

Updates #20

@codecov-io
Copy link

codecov-io commented Dec 29, 2020

Codecov Report

Merging #163 (78a4f5c) into master (039ef47) will decrease coverage by 3.73%.
The diff coverage is 54.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #163      +/-   ##
==========================================
- Coverage   79.48%   75.75%   -3.74%     
==========================================
  Files          55       58       +3     
  Lines       30881    79419   +48538     
==========================================
+ Hits        24546    60163   +35617     
- Misses       6189    19100   +12911     
- Partials      146      156      +10     
Flag Coverage Δ
integration 2.68% <75.00%> (-4.70%) ⬇️
unittests 74.98% <52.97%> (-2.62%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
build/zinstructions.go 1.70% <ø> (-3.35%) ⬇️
internal/api/types.go 0.00% <0.00%> (ø)
internal/gen/asmtest.go 0.00% <0.00%> (ø)
internal/gen/build.go 0.00% <0.00%> (ø)
internal/gen/ctors.go 0.00% <0.00%> (ø)
internal/gen/ctorstest.go 0.00% <0.00%> (ø)
internal/gen/enum.go 0.00% <0.00%> (ø)
internal/gen/godata.go 0.00% <0.00%> (ø)
internal/gen/mov.go 0.00% <0.00%> (ø)
internal/gen/optab.go 0.00% <0.00%> (ø)
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 039ef47...78a4f5c. Read the comment docs.

@mmcloughlin mmcloughlin mentioned this pull request Dec 30, 2020
@klauspost
Copy link
Contributor

Contributing a ternary logic calculator: https://gist.github.com/klauspost/d4e15beb00c8a3a3307ad6e027da58d1

All rights granted to use as you see fit :)

@klauspost klauspost mentioned this pull request Sep 15, 2021
@mmcloughlin
Copy link
Owner Author

Contributing a ternary logic calculator: https://gist.github.com/klauspost/d4e15beb00c8a3a3307ad6e027da58d1

All rights granted to use as you see fit :)

Cute! Thanks. So there is a trick for these that works most of the time. You create special constants for each of the three inputs, and then you can produce the truth table by doing the corresponding operation on the special constants. Like this:

>>> A = 0b11110000
>>> B = 0b11001100
>>> C = 0b10101010
>>> hex(A | B | C)
'0xfe'
>>> hex(A & B & C)
'0x80'
>>> hex(A ^ B ^ C)
'0x96'
>>> hex((A & B) | (~A & C)) # choose
'0xca'
>>> hex((A & B) | (A & C) | (B & C)) # majority
'0xe8'
>>> 

It's not as clean for the onebit or twobit examples, I guess.

mmcloughlin added a commit that referenced this pull request Nov 13, 2021
all: AVX-512

Extends avo to support most AVX-512 instruction sets.

The instruction type is extended to support suffixes. The K family of opmask
registers is added to the register package, and the operand package is updated
to support the new operand types. Move instruction deduction in `Load` and
`Store` is extended to support KMOV* and VMOV* forms.

Internal code generation packages were overhauled. Instruction database loading
required various messy changes to account for the additional complexities of the
AVX-512 instruction sets. The internal/api package was added to introduce a
separation between instruction forms in the database, and the functions avo
provides to create them. This was required since with instruction suffixes there
is no longer a one-to-one mapping between instruction constructors and opcodes.

AVX-512 bloated generated source code size substantially, initially increasing
compilation and CI test times to an unacceptable level. Two changes were made to
address this:

1.	Instruction constructors in the `x86` package moved to an optab-based
	approach. This compiles substantially faster than the verbose code
	generation we had before.

2.	The most verbose code-generated tests are moved under build tags and limited
	to a stress test mode. Stress test builds are run on schedule but not in
	regular CI.

An example of AVX-512 accelerated 16-lane MD5 is provided to demonstrate and
test the new functionality.

Updates #20 #163 #229

Co-authored-by: Vaughn Iverson <[email protected]>
@mmcloughlin
Copy link
Owner Author

Landed #217. Closing this, but leaving the avx512 branch since people are still using it.

mmcloughlin added a commit that referenced this pull request Nov 13, 2021
Extends avo to support most AVX-512 instruction sets.

The instruction type is extended to support suffixes. The K family of opmask
registers is added to the register package, and the operand package is updated
to support the new operand types. Move instruction deduction in `Load` and
`Store` is extended to support KMOV* and VMOV* forms.

Internal code generation packages were overhauled. Instruction database loading
required various messy changes to account for the additional complexities of the
AVX-512 instruction sets. The internal/api package was added to introduce a
separation between instruction forms in the database, and the functions avo
provides to create them. This was required since with instruction suffixes there
is no longer a one-to-one mapping between instruction constructors and opcodes.

AVX-512 bloated generated source code size substantially, initially increasing
compilation and CI test times to an unacceptable level. Two changes were made to
address this:

1.	Instruction constructors in the `x86` package moved to an optab-based
	approach. This compiles substantially faster than the verbose code
	generation we had before.

2.	The most verbose code-generated tests are moved under build tags and limited
	to a stress test mode. Stress test builds are run on schedule but not in
	regular CI.

An example of AVX-512 accelerated 16-lane MD5 is provided to demonstrate and
test the new functionality.

Updates #20 #163 #229

Co-authored-by: Vaughn Iverson <[email protected]>
mmcloughlin added a commit that referenced this pull request Nov 13, 2021
Extends avo to support most AVX-512 instruction sets.

The instruction type is extended to support suffixes. The K family of opmask
registers is added to the register package, and the operand package is updated
to support the new operand types. Move instruction deduction in `Load` and
`Store` is extended to support KMOV* and VMOV* forms.

Internal code generation packages were overhauled. Instruction database loading
required various messy changes to account for the additional complexities of the
AVX-512 instruction sets. The internal/api package was added to introduce a
separation between instruction forms in the database, and the functions avo
provides to create them. This was required since with instruction suffixes there
is no longer a one-to-one mapping between instruction constructors and opcodes.

AVX-512 bloated generated source code size substantially, initially increasing
compilation and CI test times to an unacceptable level. Two changes were made to
address this:

1.  Instruction constructors in the `x86` package moved to an optab-based
    approach. This compiles substantially faster than the verbose code
    generation we had before.

2.  The most verbose code-generated tests are moved under build tags and
    limited to a stress test mode. Stress test builds are run on
    schedule but not in regular CI.

An example of AVX-512 accelerated 16-lane MD5 is provided to demonstrate and
test the new functionality.

Updates #20 #163 #229

Co-authored-by: Vaughn Iverson <[email protected]>
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.

4 participants