liangsu9988 commited on
Commit
ded1bf8
·
verified ·
1 Parent(s): 6ad28b7

Update CARD.md

Browse files
Files changed (1) hide show
  1. CARD.md +64 -0
CARD.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: kernels
3
+ license: bsd-3-clause
4
+ tags: [cuda, blackwell, flash-attention, cute-dsl, inference]
5
+ ---
6
+
7
+ # flashrt/fa4-cute-runtime
8
+
9
+ Forward-only FlashAttention-4 CuTe DSL runtime used by FlashRT's GROOT N1.7
10
+ and PI0.5 Thor pipelines. The source is vendored under the private `flashrt_fa4`
11
+ namespace and does not shadow an installed `flash_attn` package.
12
+
13
+ This package adds the dedicated Blackwell D256 2CTA forward path required by
14
+ PI0.5's 8-Q/1-KV-head PaliGemma encoder. The community FlashAttention-4 package
15
+ already covers the D48/D72/D128 family; it does not currently expose D256 on
16
+ SM100/SM110.
17
+
18
+ ## Functions
19
+
20
+ - `flash_attn_func`
21
+ - `flash_attn_varlen_func`
22
+ - `forward_static`
23
+
24
+ ```python
25
+ from kernels import get_kernel
26
+
27
+ fa4 = get_kernel("flashrt/fa4-cute-runtime", version=1)
28
+ out = fa4.flash_attn_func(q, k, v, causal=False)
29
+ ```
30
+
31
+ The vendored forward wrapper returns `(out, lse)`; use `result[0]` when only
32
+ the attention output is needed.
33
+
34
+ For a CUDA Graph hot path, preallocate the output and use the allocation-free
35
+ entry point:
36
+
37
+ ```python
38
+ out = torch.empty_like(q)
39
+ fa4.forward_static(q, k, v, out, causal=False)
40
+ ```
41
+
42
+ For a padded fixed-shape graph, pass the valid K/V length as a CUDA int32
43
+ tensor. PI0.5 uses this form for its encoder cache:
44
+
45
+ ```python
46
+ seqused_k = torch.tensor([valid_k], device="cuda", dtype=torch.int32)
47
+ fa4.forward_static(
48
+ q, k_padded, v_padded, out,
49
+ causal=False,
50
+ pack_gqa=True,
51
+ seqused_k=seqused_k,
52
+ )
53
+ ```
54
+
55
+ Inputs follow FlashAttention's `(batch, sequence, heads, head_dim)` contract.
56
+ Qualified model profiles include D72 MHA and D256 GQA (8 Q heads / 1 KV head),
57
+ with both dense and `seqused_k` execution. This package targets SM100-family
58
+ Blackwell forward inference and requires
59
+ CUDA 13 plus `nvidia-cutlass-dsl` 4.4.x, 4.5.x, or 4.6.x. The wrapper selects Thor's
60
+ accepted architecture alias according to the installed DSL version.
61
+
62
+ This is an execution backend rather than a universal SDPA replacement. Select
63
+ it with model-shape profiling; the GROOT causal GQA profile benefits while some
64
+ short vision profiles remain faster on PyTorch SDPA.