Kernels for higher order gradients of Flash Attention.
Project description
Flash Hog
This repo contains the code for Flash Higher-Order-Gradients, aka. Flash Hog. This kernel achieves around a 3.7x speedup over an XLA optimized kernel, with linear memory scaling instead of quadratic scaling.
Installation
TODO
Method
Flash Hog does 4 recomputation passes to avoid any atomics or saving any intermediary tensors of shape (N_Q, N_K).
This shakes out to be thread-wise tiling across Q in 3 passes first, once to compute dd, then once for b, then once for both dQ' and ddO.
Finally we do another pass tiled over K, producing dK' and dV'.
The equations we implement are the following:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flash_hog-0.3.2.tar.gz.
File metadata
- Download URL: flash_hog-0.3.2.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a0a8e07ab5af4741756206e63b38c09c2396ff30a596e6c89380b334e54a10c
|
|
| MD5 |
5e459d0715aecaa2790bd784321755c1
|
|
| BLAKE2b-256 |
7a06be436d5a432669f43f646d34411e37ef9df7873f8f13c2ac5ff3b44cec82
|
File details
Details for the file flash_hog-0.3.2-py3-none-any.whl.
File metadata
- Download URL: flash_hog-0.3.2-py3-none-any.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfdd7ffb564057a334a2bd98a8eccf308b092def6e1b39b4aa551f709c80e510
|
|
| MD5 |
a801a3e39754cdcd25834a3a0f01afd6
|
|
| BLAKE2b-256 |
ebac6ec6d027531edae120eff56a1e399c97eeee2822bc9848f267ce83e7df53
|