Skip to content

avoid a reload when the avx2 round spills a row - #55

Open
BobDu wants to merge 1 commit into
zeebo:masterfrom
BobDu:avx2-spill-policy
Open

avoid a reload when the avx2 round spills a row#55
BobDu wants to merge 1 commit into
zeebo:masterfrom
BobDu:avx2-spill-policy

Conversation

@BobDu

@BobDu BobDu commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

State fills all sixteen ymm registers, so the avx2 round has to spill a row to get a rotate scratch.

It does not have to reload it: displacing a row the commutative ops can read from the memory operand removes six register moves and twenty seven reloads from every block.

Benchmarks on idle AWS m6a.large (EPYC 7R13, Zen 3) and m4.large (Xeon E5-2686 v4, Broadwell), neither of which has avx512f, the repository's BenchmarkBLAKE3, Go 1.26.5, benchstat n=20, against master at 3863282:

m6a.large, Entire master this PR delta
64 B 324.2 MiB/s 326.0 MiB/s +0.54%
256 B 627.1 MiB/s 626.5 MiB/s −0.09%
1 KiB 806.9 MiB/s 807.4 MiB/s +0.07%
2 KiB 1.464 GiB/s 1.463 GiB/s −0.02%
4 KiB 1.770 GiB/s 1.809 GiB/s +2.24%
64 KiB 3.856 GiB/s 3.956 GiB/s +2.59%
1 MiB 4.000 GiB/s 4.103 GiB/s +2.58%
m4.large, Entire master this PR delta
64 B 346.4 MiB/s 346.9 MiB/s +0.16%
256 B 562.9 MiB/s 563.0 MiB/s ~
1 KiB 670.1 MiB/s 672.0 MiB/s +0.28%
2 KiB 1.162 GiB/s 1.162 GiB/s ~
4 KiB 1.205 GiB/s 1.209 GiB/s +0.36%
64 KiB 2.559 GiB/s 2.574 GiB/s +0.59%
1 MiB 2.625 GiB/s 2.648 GiB/s +0.88%

Signed-off-by: BobDu <i@bobdu.cc>
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.

1 participant