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

Optimize aarch64 GEMM kernel #32

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Optimize aarch64 GEMM kernel #32

merged 1 commit into from
Jan 5, 2024

Conversation

robertknight
Copy link
Owner

@robertknight robertknight commented Jan 5, 2024

Revise aarch64 kernel to use SIMD intrinsics. The structure is the same as the AVX 2 / FMA kernel, but the tile size is set to 8x8 as that performed best. I did not port the prefetching logic as std::arch::aarch64::_prefetch is currently nightly only :(

On an M1 Mac (AWS mac2.metal) performance for an M=N=K=1024 matmul increases from ~334 to ~418 GFLOPS.
On a Graviton 2 (AWS c6g.xlarge) performance for an M=N=K=1024 matmul increases from ~115 to ~136 GFLOPS.

One observation from my tests is that ARM performance is much more sensitive to whether unrolling is used than the AVX kernel. Performance drops ~40 GFLOPS without it on the M1 in this test.

See #27

Revise aarch64 kernel to use SIMD intrinsics. The structure is the same as the
AVX 2 / FMA kernel, but the tile size is set to 8x8 as that performed best.

On an M1 Mac performance for an M=N=K=1024 matmul increases from ~334 to ~418
GFLOPS.
@robertknight robertknight merged commit 7350002 into main Jan 5, 2024
1 check passed
@robertknight robertknight deleted the aarch64-gemm-v2 branch January 5, 2024 23:35
@robertknight robertknight mentioned this pull request Jan 5, 2024
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