#9 · Primary category: GPU Compute Frameworks
metal-flash-attention
FlashAttention (Metal Port)
Project last updated:09/22/24
GitHub Stars
613
Forks
41
Contributors
4
License
MIT
Why we included this project
The FlashAttention algorithm, ported to Metal for Apple silicon, is worth studying for the engineering notes as much as the code. The implementation stays compact, a set of Swift sources JIT-compiled at runtime rather than a prebuilt binary, and the README explains the hard trade-offs in detail. Register pressure and the lack of native FP32 atomics on Apple hardware forced a redesigned backward pass, one that splits into separate dQ and dK/dV kernels and trades more GEMMs for full parallelization across both dimensions of the attention matrix. Performance is reported as gigainstructions per second against a roofline model instead of raw GFLOPS, with a consistent 4400 GI/s on an M1 Max at 83% ALU utilization, which gives you a concrete way to judge whether your own Metal shaders are leaving ALU throughput on the table. The register-spilling and block-tiling strategies transfer directly to anyone porting CUDA attention kernels to Apple GPUs.
Articles for this project
No articles for this project yet.
To suggest a topic or contribute an article, contact us.
Related projects in this category
kompute
General purpose GPU compute framework built on Vulkan to support 1000s of cross vendor graphics cards (AMD, Qualcomm, NVIDIA & friends). Blazing fast, mobile-enabled, asynchronous and optimized for advanced GPU data processing usecases. Backed by the Linux Foundation.
lupine
LUPINE is a GPU over IP bridge allowing GPUs on remote machines to be attached to CPU-only machines.
dstack
Vendor-agnostic orchestration for training, inference and agentic workloads across NVIDIA, AMD, TPU, and Tenstorrent on clouds, Kubernetes, and bare metal.
MetalPetal
A GPU accelerated image and video processing framework built on Metal.
tt-metal
:metal: TT-NN operator library, and TT-Metalium low level kernel programming model.