Remove non-variant benchmark files from build directory
Browse files- build/benchmarks/README.md +0 -11
- build/benchmarks/RESULTS.md +0 -35
- build/benchmarks/benchmark.py +0 -68
build/benchmarks/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
# Benchmarks
|
| 2 |
-
|
| 3 |
-
```bash
|
| 4 |
-
python benchmarks/benchmark.py --dtype bf16
|
| 5 |
-
python benchmarks/benchmark.py --dtype fp16
|
| 6 |
-
```
|
| 7 |
-
|
| 8 |
-
The FlashRT timing includes split-KV dispatch when the package heuristic selects
|
| 9 |
-
it. The SDPA baseline explicitly materializes repeated K/V heads for GQA, so
|
| 10 |
-
results must label that fact. Installed-artifact results are recorded only after
|
| 11 |
-
the corresponding Hub build is available.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/benchmarks/RESULTS.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
# Benchmark results
|
| 2 |
-
|
| 3 |
-
## Pre-release source qualification
|
| 4 |
-
|
| 5 |
-
- GPU: NVIDIA GeForce RTX 5090, SM120
|
| 6 |
-
- PyTorch: `2.9.0a0+145a3a7bda.nv25.10`
|
| 7 |
-
- CUDA: 13.0
|
| 8 |
-
- FlashRT source: `b3eab55`
|
| 9 |
-
- Dtype: BF16
|
| 10 |
-
- Timing: warmed CUDA events, median of 20 groups x 20 calls
|
| 11 |
-
- Baseline: PyTorch SDPA with GQA heads expanded before timing
|
| 12 |
-
|
| 13 |
-
| B | Sq | Sk | Hq/Hkv | D | Splits | Package us | Original FlashRT us | SDPA us | vs original | vs SDPA |
|
| 14 |
-
|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 15 |
-
| 1 | 1 | 512 | 8/2 | 128 | 4 | 10.453 | 11.340 | 11.684 | 0.922x | 1.118x |
|
| 16 |
-
| 1 | 16 | 1024 | 16/4 | 128 | 8 | 10.477 | 11.298 | 11.712 | 0.927x | 1.118x |
|
| 17 |
-
| 1 | 49 | 2520 | 24/4 | 128 | 10 | 22.761 | 23.014 | 25.011 | 0.989x | 1.099x |
|
| 18 |
-
| 1 | 64 | 4096 | 32/8 | 128 | 7 | 43.226 | 43.461 | 43.662 | 0.995x | 1.010x |
|
| 19 |
-
| 1 | 1024 | 1024 | 32/8 | 128 | 1 | 108.701 | 108.928 | 111.005 | 0.998x | 1.021x |
|
| 20 |
-
|
| 21 |
-
`vs original` is `package/original`; values at or below 1.0 show no packaged
|
| 22 |
-
kernel regression. `vs SDPA` is `SDPA/package`. K/V head expansion is excluded
|
| 23 |
-
from SDPA timing, so the comparison does not credit FlashRT for avoiding that
|
| 24 |
-
materialization.
|
| 25 |
-
|
| 26 |
-
The 40-row detailed accuracy sweep over FP16/BF16, D=64/96/128/256, MHA/GQA,
|
| 27 |
-
partial tiles and causal BF16 produced:
|
| 28 |
-
|
| 29 |
-
- worst maximum absolute error vs PyTorch SDPA: `0.001953125`
|
| 30 |
-
- worst cosine similarity: `0.9999961853`
|
| 31 |
-
- package output vs original FlashRT output on benchmark rows: exact
|
| 32 |
-
|
| 33 |
-
These are source-artifact qualification numbers, not the final Hub artifact
|
| 34 |
-
claim. Installed `kernel-builder` results replace this section after upload and
|
| 35 |
-
fresh-process `get_kernel(..., version=1)` validation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/benchmarks/benchmark.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
| 1 |
-
from __future__ import annotations
|
| 2 |
-
|
| 3 |
-
import argparse
|
| 4 |
-
import statistics
|
| 5 |
-
|
| 6 |
-
import torch
|
| 7 |
-
import torch.nn.functional as F
|
| 8 |
-
|
| 9 |
-
from fa2_seqused_runtime import allocate_outputs, allocate_workspace, forward_static
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
SHAPES = [
|
| 13 |
-
(1, 1, 512, 8, 2, 128),
|
| 14 |
-
(1, 16, 1024, 16, 4, 128),
|
| 15 |
-
(1, 49, 2520, 24, 4, 128),
|
| 16 |
-
(1, 64, 4096, 32, 8, 128),
|
| 17 |
-
(1, 1024, 1024, 32, 8, 128),
|
| 18 |
-
]
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
def time_us(fn, warmup=50, repeats=200):
|
| 22 |
-
for _ in range(warmup):
|
| 23 |
-
fn()
|
| 24 |
-
torch.cuda.synchronize()
|
| 25 |
-
samples = []
|
| 26 |
-
for _ in range(repeats):
|
| 27 |
-
start = torch.cuda.Event(enable_timing=True)
|
| 28 |
-
end = torch.cuda.Event(enable_timing=True)
|
| 29 |
-
start.record()
|
| 30 |
-
fn()
|
| 31 |
-
end.record()
|
| 32 |
-
end.synchronize()
|
| 33 |
-
samples.append(start.elapsed_time(end) * 1000.0)
|
| 34 |
-
return statistics.median(samples)
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
def main():
|
| 38 |
-
parser = argparse.ArgumentParser()
|
| 39 |
-
parser.add_argument("--dtype", choices=("bf16", "fp16"), default="bf16")
|
| 40 |
-
args = parser.parse_args()
|
| 41 |
-
dtype = torch.bfloat16 if args.dtype == "bf16" else torch.float16
|
| 42 |
-
print("B,Sq,Sk,Hq,Hkv,D,FlashRT_us,SDPA_expandedGQA_us,Speedup")
|
| 43 |
-
for batch, sq, sk, hq, hkv, dim in SHAPES:
|
| 44 |
-
q = torch.randn(batch, sq, hq, dim, device="cuda", dtype=dtype)
|
| 45 |
-
k = torch.randn(batch, sk, hkv, dim, device="cuda", dtype=dtype)
|
| 46 |
-
v = torch.randn_like(k)
|
| 47 |
-
out, lse = allocate_outputs(q)
|
| 48 |
-
workspace = allocate_workspace(q, k)
|
| 49 |
-
kr = k.repeat_interleave(hq // hkv, dim=2)
|
| 50 |
-
vr = v.repeat_interleave(hq // hkv, dim=2)
|
| 51 |
-
|
| 52 |
-
def flashrt():
|
| 53 |
-
forward_static(q, k, v, out=out, softmax_lse=lse, workspace=workspace)
|
| 54 |
-
|
| 55 |
-
def sdpa():
|
| 56 |
-
F.scaled_dot_product_attention(
|
| 57 |
-
q.permute(0, 2, 1, 3),
|
| 58 |
-
kr.permute(0, 2, 1, 3),
|
| 59 |
-
vr.permute(0, 2, 1, 3),
|
| 60 |
-
)
|
| 61 |
-
|
| 62 |
-
flashrt_us = time_us(flashrt)
|
| 63 |
-
sdpa_us = time_us(sdpa)
|
| 64 |
-
print(f"{batch},{sq},{sk},{hq},{hkv},{dim},{flashrt_us:.3f},{sdpa_us:.3f},{sdpa_us / flashrt_us:.3f}")
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
if __name__ == "__main__":
|
| 68 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|