Document complete JSON ops, call bindings and runnable attention examples
Browse files- README.md +336 -0
- SHA256SUMS +8 -1
- examples/decode-ops.json +309 -0
- examples/decode.json +418 -0
- examples/prefill-ops.json +284 -0
- examples/prefill.json +393 -0
- examples/run_examples.py +75 -0
- examples/verify.json +393 -0
- validation/json-examples.json +29 -0
README.md
CHANGED
|
@@ -96,6 +96,342 @@ The upstream comparison covers **FlashAttention-4, TRTLLM-GEN and CuTe DSL**:
|
|
| 96 |
uses ragged KV with repacking excluded from timing. Read
|
| 97 |
[the benchmark methodology](benchmarks/upstream/README.md) before comparing.
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
## Download and install
|
| 100 |
|
| 101 |
```python
|
|
|
|
| 96 |
uses ragged KV with repacking excluded from timing. Read
|
| 97 |
[the benchmark methodology](benchmarks/upstream/README.md) before comparing.
|
| 98 |
|
| 99 |
+
## How to wire `ops` in JSON
|
| 100 |
+
|
| 101 |
+
The key is lowercase **`ops`**. Separate the pinned binary (`modules`), the
|
| 102 |
+
kernel ABI (`ops.<name>.impl.launches`), and each invocation
|
| 103 |
+
(`programs.<program>.calls`). The complete snippets below contain **every
|
| 104 |
+
packed field**, without omitted bytes or placeholder hashes.
|
| 105 |
+
|
| 106 |
+
### 1. Add the module and op definition
|
| 107 |
+
|
| 108 |
+
For the shipped Qwen3.8-27B state layout, merge these top-level dictionaries
|
| 109 |
+
into your manifest:
|
| 110 |
+
|
| 111 |
+
- [decode-ops.json](examples/decode-ops.json): one-token-per-sequence decode,
|
| 112 |
+
fixed 38-way split-KV, including counter/statistics/partial-output scratch.
|
| 113 |
+
- [prefill-ops.json](examples/prefill-ops.json): causal prefill and multi-token
|
| 114 |
+
verification, including a pre-existing KV prefix.
|
| 115 |
+
|
| 116 |
+
These two fragments require the **model profile**: `tokens.max = 2048`,
|
| 117 |
+
`seqs.max = 128`, maximum context 262144, page size 64, and **16 interleaved KV
|
| 118 |
+
layers**. They use `in state` for K/V. They are merge fragments, not complete
|
| 119 |
+
manifests. For isolated buffer-based tests, use the complete smaller examples
|
| 120 |
+
in step 4; their bounds and KV strides are intentionally different.
|
| 121 |
+
|
| 122 |
+
<details>
|
| 123 |
+
<summary>Complete decode modules + ops JSON</summary>
|
| 124 |
+
|
| 125 |
+
```json
|
| 126 |
+
{
|
| 127 |
+
"modules": {
|
| 128 |
+
"fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen": {
|
| 129 |
+
"source": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen.cubin",
|
| 130 |
+
"sha256": "a5c3300d05153675d2c6c432c50be888f3e0a8bb6c3ffbdaed48fbb25e52f86e"
|
| 131 |
+
}
|
| 132 |
+
},
|
| 133 |
+
"ops": {
|
| 134 |
+
"attn_decode": {
|
| 135 |
+
"params": ["out buffer<bf16>", "in buffer<bf16>", "in state", "in state", "in buffer<i32>", "in buffer<i32>", "in buffer<i32>", "i32", "i32"],
|
| 136 |
+
"impl": {
|
| 137 |
+
"scratch": {
|
| 138 |
+
"counter": {
|
| 139 |
+
"dtype": "i32",
|
| 140 |
+
"shape": [3072]
|
| 141 |
+
},
|
| 142 |
+
"stats": {
|
| 143 |
+
"dtype": "f32",
|
| 144 |
+
"shape": [128, 4, 38, 8, 2]
|
| 145 |
+
},
|
| 146 |
+
"partial": {
|
| 147 |
+
"dtype": "f32",
|
| 148 |
+
"shape": [128, 4, 38, 8, 256]
|
| 149 |
+
}
|
| 150 |
+
},
|
| 151 |
+
"launches": [
|
| 152 |
+
{
|
| 153 |
+
"module": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen",
|
| 154 |
+
"entry": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen",
|
| 155 |
+
"params": ["bytes<1280>"],
|
| 156 |
+
"block": [512, 1, 1],
|
| 157 |
+
"grid": [38, 4, "seqs"],
|
| 158 |
+
"shared_mem": 144992,
|
| 159 |
+
"args": [
|
| 160 |
+
{
|
| 161 |
+
"pack": {
|
| 162 |
+
"size": 1280,
|
| 163 |
+
"fields": [
|
| 164 |
+
{"at": 0, "tensormap": {"param": 1, "dtype": "bf16", "dims": [256, 6, 4, 2048], "strides": [512, 3072, 12288], "box": [64, 6, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 165 |
+
{"at": 128, "tensormap": {"param": 2, "dtype": "bf16", "dims": [256, 64, 4, 0], "strides": [4096, 1024, 4194304], "box": [64, 64, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 166 |
+
{"at": 384, "tensormap": {"param": 3, "dtype": "bf16", "dims": [256, 64, 4, 0], "strides": [4096, 1024, 4194304], "box": [64, 64, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 167 |
+
{"at": 512, "tensormap": {"param": 0, "dtype": "bf16", "dims": [256, 2048, 4, 6, 1], "strides": [12288, 512, 2048, 16], "box": [64, 8, 1, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 168 |
+
{"at": 912, "param": 0},
|
| 169 |
+
{"at": 1000, "param": 4},
|
| 170 |
+
{"at": 1080, "param": 5},
|
| 171 |
+
{"at": 1116, "param": 7},
|
| 172 |
+
{"at": 1244, "param": 8},
|
| 173 |
+
{"at": 1112, "i32": 2147483647},
|
| 174 |
+
{"at": 1144, "i32": 1},
|
| 175 |
+
{"at": 1148, "i32": 262144},
|
| 176 |
+
{"at": 1152, "i32": 1},
|
| 177 |
+
{"at": 1156, "i32": 38},
|
| 178 |
+
{"at": 1160, "i32": 4096},
|
| 179 |
+
{"at": 1164, "i32": 4},
|
| 180 |
+
{"at": 1168, "i32": 24},
|
| 181 |
+
{"at": 1172, "i32": 6},
|
| 182 |
+
{"at": 1176, "i32": 6},
|
| 183 |
+
{"at": 1180, "i32": -1431655765},
|
| 184 |
+
{"at": 1188, "i32": 2},
|
| 185 |
+
{"at": 1192, "i32": 6144},
|
| 186 |
+
{"at": 1200, "i32": 1048576},
|
| 187 |
+
{"at": 1204, "i32": 1},
|
| 188 |
+
{"at": 1208, "i32": 6},
|
| 189 |
+
{"at": 1212, "i32": 1},
|
| 190 |
+
{"at": 1216, "i32": 1065353216},
|
| 191 |
+
{"at": 1220, "i32": 1035512379},
|
| 192 |
+
{"at": 1224, "i32": 1065353216},
|
| 193 |
+
{"at": 1228, "i32": -1082130432},
|
| 194 |
+
{"at": 1252, "i32": 256},
|
| 195 |
+
{"at": 984, "scratch": "counter"},
|
| 196 |
+
{"at": 1008, "scratch": "partial"},
|
| 197 |
+
{"at": 1016, "scratch": "stats"}
|
| 198 |
+
]
|
| 199 |
+
}
|
| 200 |
+
}
|
| 201 |
+
]
|
| 202 |
+
}
|
| 203 |
+
]
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
</details>
|
| 211 |
+
|
| 212 |
+
<details>
|
| 213 |
+
<summary>Complete prefill modules + ops JSON</summary>
|
| 214 |
+
|
| 215 |
+
```json
|
| 216 |
+
{
|
| 217 |
+
"modules": {
|
| 218 |
+
"fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext": {
|
| 219 |
+
"source": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext.cubin",
|
| 220 |
+
"sha256": "270e5246cd40181234f075ae4e05e0e53fbe662e46640807b44daf272cd5aed7"
|
| 221 |
+
}
|
| 222 |
+
},
|
| 223 |
+
"ops": {
|
| 224 |
+
"attn_prefill": {
|
| 225 |
+
"params": ["out buffer<bf16>", "in buffer<bf16>", "in state", "in state", "in buffer<i32>", "in buffer<i32>", "in buffer<i32>", "i32", "i32"],
|
| 226 |
+
"impl": {
|
| 227 |
+
"scratch": {},
|
| 228 |
+
"launches": [
|
| 229 |
+
{
|
| 230 |
+
"module": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 231 |
+
"entry": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 232 |
+
"params": ["bytes<1280>"],
|
| 233 |
+
"block": [384, 1, 1],
|
| 234 |
+
"grid": [
|
| 235 |
+
{
|
| 236 |
+
"ceil_div": ["tokens", 128]
|
| 237 |
+
},
|
| 238 |
+
24,
|
| 239 |
+
"seqs"
|
| 240 |
+
],
|
| 241 |
+
"shared_mem": 197872,
|
| 242 |
+
"args": [
|
| 243 |
+
{
|
| 244 |
+
"pack": {
|
| 245 |
+
"size": 1280,
|
| 246 |
+
"fields": [
|
| 247 |
+
{"at": 0, "tensormap": {"param": 1, "dtype": "bf16", "dims": [256, 1, 24, 2048], "strides": [512, 512, 12288], "box": [64, 1, 1, 128], "swizzle": 128, "l2_promotion": 128}},
|
| 248 |
+
{"at": 128, "tensormap": {"param": 2, "dtype": "bf16", "dims": [256, 64, 4, 0], "strides": [4096, 1024, 4194304], "box": [64, 64, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 249 |
+
{"at": 384, "tensormap": {"param": 3, "dtype": "bf16", "dims": [256, 64, 4, 0], "strides": [4096, 1024, 4194304], "box": [64, 64, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 250 |
+
{"at": 512, "tensormap": {"param": 0, "dtype": "bf16", "dims": [256, 2048, 4, 6, 1], "strides": [12288, 512, 2048, 16], "box": [64, 128, 1, 1, 1], "swizzle": 128, "l2_promotion": 128}},
|
| 251 |
+
{"at": 912, "param": 0},
|
| 252 |
+
{"at": 1000, "param": 4},
|
| 253 |
+
{"at": 1080, "param": 5},
|
| 254 |
+
{"at": 1116, "param": 7},
|
| 255 |
+
{"at": 1244, "param": 8},
|
| 256 |
+
{"at": 936, "param": 6},
|
| 257 |
+
{"at": 1144, "param": 8},
|
| 258 |
+
{"at": 1152, "expr": {"ceil_div": ["tokens", 128]}},
|
| 259 |
+
{"at": 1112, "i32": 2147483647},
|
| 260 |
+
{"at": 1148, "i32": 262144},
|
| 261 |
+
{"at": 1156, "i32": 1},
|
| 262 |
+
{"at": 1160, "i32": 4096},
|
| 263 |
+
{"at": 1164, "i32": 4},
|
| 264 |
+
{"at": 1168, "i32": 24},
|
| 265 |
+
{"at": 1172, "i32": 6},
|
| 266 |
+
{"at": 1176, "i32": 6},
|
| 267 |
+
{"at": 1180, "i32": -1431655765},
|
| 268 |
+
{"at": 1188, "i32": 2},
|
| 269 |
+
{"at": 1192, "i32": 6144},
|
| 270 |
+
{"at": 1200, "i32": 1048576},
|
| 271 |
+
{"at": 1204, "i32": 128},
|
| 272 |
+
{"at": 1208, "i32": 6},
|
| 273 |
+
{"at": 1212, "i32": 1},
|
| 274 |
+
{"at": 1216, "i32": 1065353216},
|
| 275 |
+
{"at": 1220, "i32": 1035512379},
|
| 276 |
+
{"at": 1224, "i32": 1065353216},
|
| 277 |
+
{"at": 1228, "i32": -1082130432},
|
| 278 |
+
{"at": 1252, "i32": 256}
|
| 279 |
+
]
|
| 280 |
+
}
|
| 281 |
+
}
|
| 282 |
+
]
|
| 283 |
+
}
|
| 284 |
+
]
|
| 285 |
+
}
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
}
|
| 289 |
+
```
|
| 290 |
+
|
| 291 |
+
</details>
|
| 292 |
+
|
| 293 |
+
### 2. Bind the nine op parameters in a call
|
| 294 |
+
|
| 295 |
+
Example: decode at the **second full-attention KV slot** (zero-based slot 1):
|
| 296 |
+
|
| 297 |
+
```json
|
| 298 |
+
{
|
| 299 |
+
"label": "full_attn_slot_1.decode",
|
| 300 |
+
"op": "attn_decode",
|
| 301 |
+
"args": [
|
| 302 |
+
{"buf": "attn_out"},
|
| 303 |
+
{"buf": "q_n"},
|
| 304 |
+
{"state": "kv", "offset": 262144},
|
| 305 |
+
{"state": "kv", "offset": 262656},
|
| 306 |
+
{"buf": "block_table"},
|
| 307 |
+
{"buf": "seq_lens"},
|
| 308 |
+
{"buf": "cu_seqlens_q"},
|
| 309 |
+
{"var": "seqs"},
|
| 310 |
+
{"var": "tokens"}
|
| 311 |
+
]
|
| 312 |
+
}
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
Put this object in your decode program's `calls` array. All buffer/state names
|
| 316 |
+
are references to declarations in that same manifest. For prefill or verify,
|
| 317 |
+
use the same binding order and change `"op"` to `"attn_prefill"`.
|
| 318 |
+
|
| 319 |
+
| Index | Binding | Contract |
|
| 320 |
+
|---:|---|---|
|
| 321 |
+
| 0 | `attn_out` | Contiguous BF16 output `[total_query_rows, 24, 256]` |
|
| 322 |
+
| 1 | `q_n` | Contiguous BF16 Q, same geometry |
|
| 323 |
+
| 2 | `kv` + K offset | Paged K, with the declared interleaved layer layout |
|
| 324 |
+
| 3 | `kv` + V offset | Same state; V starts 512 bytes after K |
|
| 325 |
+
| 4 | `block_table` | Contiguous int32 `[batch, 4096]` for this model profile |
|
| 326 |
+
| 5 | `seq_lens` | Int32 total KV length per sequence, including current Q tokens |
|
| 327 |
+
| 6 | `cu_seqlens_q` | Int32 cumulative query rows, length `batch + 1` |
|
| 328 |
+
| 7 | `seqs` | Live sequence count, passed as int32 |
|
| 329 |
+
| 8 | `tokens` | Total live query rows across sequences, passed as int32 |
|
| 330 |
+
|
| 331 |
+
All offsets and TMA strides in these manifests are **bytes**. One layer's page
|
| 332 |
+
occupies `64 * 4 * 2 * 256 * 2 = 262144` bytes. For full-attention slot `L`,
|
| 333 |
+
K offset is `L * 262144`, and V offset is K + 512. The physical stride between
|
| 334 |
+
pages is `16 * 262144 = 4194304` bytes. `L` is the KV slot among the 16 full
|
| 335 |
+
attention layers, not the absolute transformer layer number.
|
| 336 |
+
|
| 337 |
+
### 3. Set live query/KV metadata
|
| 338 |
+
|
| 339 |
+
For two sequences with total KV lengths `[385, 641]`:
|
| 340 |
+
|
| 341 |
+
| Operation | `seqs` | `tokens` | `cu_seqlens_q` | Call op |
|
| 342 |
+
|---|---:|---:|---|---|
|
| 343 |
+
| Decode, one new token each | 2 | 2 | `[0, 1, 2]` | `attn_decode` |
|
| 344 |
+
| Prefill, 129 new tokens each | 2 | 258 | `[0, 129, 258]` | `attn_prefill` |
|
| 345 |
+
| Verify, 8 candidate tokens each | 2 | 16 | `[0, 8, 16]` | `attn_prefill` |
|
| 346 |
+
|
| 347 |
+
The KV pages must already contain the current query tokens' K/V (after KV
|
| 348 |
+
append). Causal masking is bottom-right aligned: for query row `j` within a
|
| 349 |
+
sequence, visible KV ends at `kv_len - q_len + j`. Verify computes attention
|
| 350 |
+
for the candidates; acceptance/rejection is handled by the surrounding model
|
| 351 |
+
program. `tokens` is **not** the context length.
|
| 352 |
+
|
| 353 |
+
The op receives one 1280-byte packed launch argument. A `param` inside that
|
| 354 |
+
pack indexes the nine op parameters above. `at` is the byte offset in the
|
| 355 |
+
pack. `tensormap` fields let kern create the TMA descriptors from the actual
|
| 356 |
+
bound allocations; the zero outer KV dimension means span the bound storage.
|
| 357 |
+
`scratch` names refer to this op's `impl.scratch`, allocated by kern rather
|
| 358 |
+
than passed by the caller. Split counters start zero and are reused across
|
| 359 |
+
replays. Do not share one scratch allocation across concurrent launches on
|
| 360 |
+
independent streams.
|
| 361 |
+
|
| 362 |
+
### 4. Complete, small manifests you can run
|
| 363 |
+
|
| 364 |
+
- [decode.json](examples/decode.json): batch 2, one query token each.
|
| 365 |
+
- [prefill.json](examples/prefill.json): batch 2, 129 query tokens each.
|
| 366 |
+
- [verify.json](examples/verify.json): batch 2, 8 query tokens each.
|
| 367 |
+
|
| 368 |
+
These are complete schema-v4 manifests, with buffers, variables, modules,
|
| 369 |
+
ops and calls. They use a two-layer KV **buffer**, not the model's opaque
|
| 370 |
+
16-layer state: `[22 pages, 2 layers, 64 slots, 4 heads, 2 (K/V), 256]`.
|
| 371 |
+
Calls select layer 1. Each sequence has 11 page-table entries; maximum context
|
| 372 |
+
is 704. Buffer-backed K/V parameters are `in buffer<bf16>` and the call uses
|
| 373 |
+
`{"buf": "kv", "offset": ...}`. The shape is different from step 1, so use
|
| 374 |
+
each complete file intact.
|
| 375 |
+
|
| 376 |
+
After the installation steps below, verify them without a GPU:
|
| 377 |
+
|
| 378 |
+
```bash
|
| 379 |
+
cargo run -q -p kern-manifest --example verify -- \
|
| 380 |
+
"$DATASET/examples/decode.json" \
|
| 381 |
+
"$DATASET/examples/prefill.json" \
|
| 382 |
+
"$DATASET/examples/verify.json"
|
| 383 |
+
```
|
| 384 |
+
|
| 385 |
+
These are op-only fixtures for `program_io`, so the verifier prints
|
| 386 |
+
`verified` followed by missing serving-protocol fills. That is expected;
|
| 387 |
+
they are not standalone model-serving manifests for `kern run`.
|
| 388 |
+
|
| 389 |
+
For a ready-to-run correctness demo, this script creates the inputs and checks
|
| 390 |
+
each exact JSON file against FlashInfer after repeated graph replay. All three
|
| 391 |
+
pass on GB300; [recorded results](validation/json-examples.json) are included:
|
| 392 |
+
|
| 393 |
+
```bash
|
| 394 |
+
CUDA_VISIBLE_DEVICES=0 python "$DATASET/examples/run_examples.py" \
|
| 395 |
+
--runner target/release/examples/program_io --cubins kernels-trtllm \
|
| 396 |
+
--output results/example-validation.json
|
| 397 |
+
```
|
| 398 |
+
|
| 399 |
+
With raw contiguous BF16 Q/KV and int32 metadata prepared for the chosen file:
|
| 400 |
+
|
| 401 |
+
```bash
|
| 402 |
+
target/release/examples/program_io --gpu 0 \
|
| 403 |
+
--manifest "$DATASET/examples/decode.json" --cubins kernels-trtllm \
|
| 404 |
+
--env seqs=2 --env tokens=2 --graph --iters 9 \
|
| 405 |
+
--in q=q.bin --in kv=kv.bin --in table=table.bin \
|
| 406 |
+
--in seq=seq.bin --in cuq=cuq.bin --out out=out.bin
|
| 407 |
+
```
|
| 408 |
+
|
| 409 |
+
Use `tokens=258` for prefill or `tokens=16` for verify, with the corresponding
|
| 410 |
+
JSON and query inputs. Read only the first `tokens * 24 * 256` BF16 output
|
| 411 |
+
values; the declared Q/O capacity may exceed the live row count.
|
| 412 |
+
|
| 413 |
+
### 5. Generate another supported capacity
|
| 414 |
+
|
| 415 |
+
Use the recipe to regenerate the packed constants, descriptors and scratch
|
| 416 |
+
bounds together, instead of changing only the grid:
|
| 417 |
+
|
| 418 |
+
```python
|
| 419 |
+
from trtllm_attention import op
|
| 420 |
+
|
| 421 |
+
# Run with PYTHONPATH pointing at the kern checkout's tools/ directory.
|
| 422 |
+
decode = op("decode", max_rows=2048, max_seqs=32,
|
| 423 |
+
max_context=262144, layers=16, splits=38)
|
| 424 |
+
prefill = op("prefill", max_rows=2048, max_seqs=32,
|
| 425 |
+
max_context=262144, layers=16)
|
| 426 |
+
# Add these to your generator's manifest["ops"], wire calls and buffers,
|
| 427 |
+
# then call kern_manifest.normalize(manifest) before writing JSON.
|
| 428 |
+
```
|
| 429 |
+
|
| 430 |
+
The Python generator uses inline `cubin`/`sha256` fields; `normalize` hoists
|
| 431 |
+
them into the final `modules` table. Fetch pinned binaries with
|
| 432 |
+
`python tools/trtllm_attention.py --download kernels-trtllm`.
|
| 433 |
+
Only BF16 Q24/KV4/D256, page 64, and the documented SM103 profile are covered.
|
| 434 |
+
|
| 435 |
## Download and install
|
| 436 |
|
| 437 |
```python
|
SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
|
| 2 |
1b8eca9a8d6fc2817acef67c4ebc7106567e6a1372fdfd538416a7b26130ca17 NOTICE
|
| 3 |
-
|
| 4 |
4a9ffeb056cf9c3bf26c53e29bdd489c90d8bd2bff873a86bd4ac4d274fd5a5d artifacts/cache.json
|
| 5 |
20cdb5819506490f42f51a8d440bbb79876d3bc7d59ea345bc3aff762e9dd58e artifacts/qwen38_cache_p64.cubin
|
| 6 |
a4adaf3b7f7aeed32cb2a857bb379cb385129880862b72c7ebfd84b50199fc01 benchmarks/triton-vs-trtllm/README.md
|
|
@@ -15,6 +15,12 @@ f8f99c1661882956e6b07f64bd781f5bd2776dd541cec142957f4cef98e39cbe benchmarks/ups
|
|
| 15 |
d25f7a3dcf76bab567a7dc720b5f9ce40a77c4fe7f24cb4b62f8d63f2afafcef benchmarks/upstream/results/summary.md
|
| 16 |
d7096c92e57673c0944438ca9f8b6413295099921cff8a821c6f5925715249e9 benchmarks/upstream/scripts/bench_attention.py
|
| 17 |
3f434ad8d62474cdf10b67119b954318e7ed4c3d3095affcbaa14a75e9de081a benchmarks/upstream/scripts/summarize.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
9ba8938ed4094c22df27d449d61f70ed0f82c0498107665bfb42eec38417efeb manifests/qwen3.8-27b-dflash2.json
|
| 19 |
c21cc0569e7662f6d0fc724a9e726c8ea8d4bc01e47233e4c4ebb29e2d40af45 manifests/qwen3.8-27b.json
|
| 20 |
b88346b12f83da430530523bd7faccde965878b55030316763c44b058cb52e2c package.json
|
|
@@ -28,5 +34,6 @@ ff9db57615b1455cd41527fa75f24c5abbe3d9abd5677fd3edc7c7b145a941f1 tools/trtllm-g
|
|
| 28 |
04eb4afe84485fe3b0a05697328647219c2ec0c81dad37804c3bde8a9c5bf775 validation/README.md
|
| 29 |
29b224d4d686c67c1379ef8b9369ccb137ca51ca21cf4e019f480147e4e208f3 validation/attention.jsonl
|
| 30 |
bcad52cb2bc97bf2c917791bb7f0ab08ef465c4c12c66db45415f8fd56667a2c validation/dflash.json
|
|
|
|
| 31 |
dea15ddde4a9b1f541f12f79b5bea2793eb24b59b9e8858f87198a15581ac04c validation/model-generation.json
|
| 32 |
b55332ce6cf0296ed04f7a75a5204766b52edcf46902cbe81eb40b913c8ae083 validation/model-logits.json
|
|
|
|
| 1 |
cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
|
| 2 |
1b8eca9a8d6fc2817acef67c4ebc7106567e6a1372fdfd538416a7b26130ca17 NOTICE
|
| 3 |
+
2aff07262bda1730a23ba427e09f13441154f7f91c21fbe663914ebd75312653 README.md
|
| 4 |
4a9ffeb056cf9c3bf26c53e29bdd489c90d8bd2bff873a86bd4ac4d274fd5a5d artifacts/cache.json
|
| 5 |
20cdb5819506490f42f51a8d440bbb79876d3bc7d59ea345bc3aff762e9dd58e artifacts/qwen38_cache_p64.cubin
|
| 6 |
a4adaf3b7f7aeed32cb2a857bb379cb385129880862b72c7ebfd84b50199fc01 benchmarks/triton-vs-trtllm/README.md
|
|
|
|
| 15 |
d25f7a3dcf76bab567a7dc720b5f9ce40a77c4fe7f24cb4b62f8d63f2afafcef benchmarks/upstream/results/summary.md
|
| 16 |
d7096c92e57673c0944438ca9f8b6413295099921cff8a821c6f5925715249e9 benchmarks/upstream/scripts/bench_attention.py
|
| 17 |
3f434ad8d62474cdf10b67119b954318e7ed4c3d3095affcbaa14a75e9de081a benchmarks/upstream/scripts/summarize.py
|
| 18 |
+
7519ff0f6bdac7731e55922c451af60159352c2f41f562b1720f50404aa6ef4f examples/decode-ops.json
|
| 19 |
+
b81cf330471752c3304c5fc5f716eb31a7e8c7bf777007b70c2d31a4ef9133eb examples/decode.json
|
| 20 |
+
422240e1ed4cf7834d0fdbdd43d683365ecabfcd8079a5c161dc851d0a0672d9 examples/prefill-ops.json
|
| 21 |
+
b4d849bde7810a9e80a57a7d708ff3d68cb8026453ece1fb569b985bed46f510 examples/prefill.json
|
| 22 |
+
2ed1e9fafae913b9bb86bd21e4351cf1371480163d510c5e186916888363515d examples/run_examples.py
|
| 23 |
+
b1968ca27ff9aac90cfa4871f7f15702c6064bc46d2427609a2faecc9b80b241 examples/verify.json
|
| 24 |
9ba8938ed4094c22df27d449d61f70ed0f82c0498107665bfb42eec38417efeb manifests/qwen3.8-27b-dflash2.json
|
| 25 |
c21cc0569e7662f6d0fc724a9e726c8ea8d4bc01e47233e4c4ebb29e2d40af45 manifests/qwen3.8-27b.json
|
| 26 |
b88346b12f83da430530523bd7faccde965878b55030316763c44b058cb52e2c package.json
|
|
|
|
| 34 |
04eb4afe84485fe3b0a05697328647219c2ec0c81dad37804c3bde8a9c5bf775 validation/README.md
|
| 35 |
29b224d4d686c67c1379ef8b9369ccb137ca51ca21cf4e019f480147e4e208f3 validation/attention.jsonl
|
| 36 |
bcad52cb2bc97bf2c917791bb7f0ab08ef465c4c12c66db45415f8fd56667a2c validation/dflash.json
|
| 37 |
+
61d8e32ef9c309dcec5e7f2d0a4bc581c1e3d684a67495aadaa405c24951d533 validation/json-examples.json
|
| 38 |
dea15ddde4a9b1f541f12f79b5bea2793eb24b59b9e8858f87198a15581ac04c validation/model-generation.json
|
| 39 |
b55332ce6cf0296ed04f7a75a5204766b52edcf46902cbe81eb40b913c8ae083 validation/model-logits.json
|
examples/decode-ops.json
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"modules": {
|
| 3 |
+
"fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen": {
|
| 4 |
+
"source": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen.cubin",
|
| 5 |
+
"sha256": "a5c3300d05153675d2c6c432c50be888f3e0a8bb6c3ffbdaed48fbb25e52f86e"
|
| 6 |
+
}
|
| 7 |
+
},
|
| 8 |
+
"ops": {
|
| 9 |
+
"attn_decode": {
|
| 10 |
+
"params": [
|
| 11 |
+
"out buffer<bf16>",
|
| 12 |
+
"in buffer<bf16>",
|
| 13 |
+
"in state",
|
| 14 |
+
"in state",
|
| 15 |
+
"in buffer<i32>",
|
| 16 |
+
"in buffer<i32>",
|
| 17 |
+
"in buffer<i32>",
|
| 18 |
+
"i32",
|
| 19 |
+
"i32"
|
| 20 |
+
],
|
| 21 |
+
"impl": {
|
| 22 |
+
"scratch": {
|
| 23 |
+
"counter": {
|
| 24 |
+
"dtype": "i32",
|
| 25 |
+
"shape": [
|
| 26 |
+
3072
|
| 27 |
+
]
|
| 28 |
+
},
|
| 29 |
+
"stats": {
|
| 30 |
+
"dtype": "f32",
|
| 31 |
+
"shape": [
|
| 32 |
+
128,
|
| 33 |
+
4,
|
| 34 |
+
38,
|
| 35 |
+
8,
|
| 36 |
+
2
|
| 37 |
+
]
|
| 38 |
+
},
|
| 39 |
+
"partial": {
|
| 40 |
+
"dtype": "f32",
|
| 41 |
+
"shape": [
|
| 42 |
+
128,
|
| 43 |
+
4,
|
| 44 |
+
38,
|
| 45 |
+
8,
|
| 46 |
+
256
|
| 47 |
+
]
|
| 48 |
+
}
|
| 49 |
+
},
|
| 50 |
+
"launches": [
|
| 51 |
+
{
|
| 52 |
+
"module": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen",
|
| 53 |
+
"entry": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen",
|
| 54 |
+
"params": [
|
| 55 |
+
"bytes<1280>"
|
| 56 |
+
],
|
| 57 |
+
"block": [
|
| 58 |
+
512,
|
| 59 |
+
1,
|
| 60 |
+
1
|
| 61 |
+
],
|
| 62 |
+
"grid": [
|
| 63 |
+
38,
|
| 64 |
+
4,
|
| 65 |
+
"seqs"
|
| 66 |
+
],
|
| 67 |
+
"shared_mem": 144992,
|
| 68 |
+
"args": [
|
| 69 |
+
{
|
| 70 |
+
"pack": {
|
| 71 |
+
"size": 1280,
|
| 72 |
+
"fields": [
|
| 73 |
+
{
|
| 74 |
+
"at": 0,
|
| 75 |
+
"tensormap": {
|
| 76 |
+
"param": 1,
|
| 77 |
+
"dtype": "bf16",
|
| 78 |
+
"dims": [
|
| 79 |
+
256,
|
| 80 |
+
6,
|
| 81 |
+
4,
|
| 82 |
+
2048
|
| 83 |
+
],
|
| 84 |
+
"strides": [
|
| 85 |
+
512,
|
| 86 |
+
3072,
|
| 87 |
+
12288
|
| 88 |
+
],
|
| 89 |
+
"box": [
|
| 90 |
+
64,
|
| 91 |
+
6,
|
| 92 |
+
1,
|
| 93 |
+
1
|
| 94 |
+
],
|
| 95 |
+
"swizzle": 128,
|
| 96 |
+
"l2_promotion": 128
|
| 97 |
+
}
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"at": 128,
|
| 101 |
+
"tensormap": {
|
| 102 |
+
"param": 2,
|
| 103 |
+
"dtype": "bf16",
|
| 104 |
+
"dims": [
|
| 105 |
+
256,
|
| 106 |
+
64,
|
| 107 |
+
4,
|
| 108 |
+
0
|
| 109 |
+
],
|
| 110 |
+
"strides": [
|
| 111 |
+
4096,
|
| 112 |
+
1024,
|
| 113 |
+
4194304
|
| 114 |
+
],
|
| 115 |
+
"box": [
|
| 116 |
+
64,
|
| 117 |
+
64,
|
| 118 |
+
1,
|
| 119 |
+
1
|
| 120 |
+
],
|
| 121 |
+
"swizzle": 128,
|
| 122 |
+
"l2_promotion": 128
|
| 123 |
+
}
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"at": 384,
|
| 127 |
+
"tensormap": {
|
| 128 |
+
"param": 3,
|
| 129 |
+
"dtype": "bf16",
|
| 130 |
+
"dims": [
|
| 131 |
+
256,
|
| 132 |
+
64,
|
| 133 |
+
4,
|
| 134 |
+
0
|
| 135 |
+
],
|
| 136 |
+
"strides": [
|
| 137 |
+
4096,
|
| 138 |
+
1024,
|
| 139 |
+
4194304
|
| 140 |
+
],
|
| 141 |
+
"box": [
|
| 142 |
+
64,
|
| 143 |
+
64,
|
| 144 |
+
1,
|
| 145 |
+
1
|
| 146 |
+
],
|
| 147 |
+
"swizzle": 128,
|
| 148 |
+
"l2_promotion": 128
|
| 149 |
+
}
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"at": 512,
|
| 153 |
+
"tensormap": {
|
| 154 |
+
"param": 0,
|
| 155 |
+
"dtype": "bf16",
|
| 156 |
+
"dims": [
|
| 157 |
+
256,
|
| 158 |
+
2048,
|
| 159 |
+
4,
|
| 160 |
+
6,
|
| 161 |
+
1
|
| 162 |
+
],
|
| 163 |
+
"strides": [
|
| 164 |
+
12288,
|
| 165 |
+
512,
|
| 166 |
+
2048,
|
| 167 |
+
16
|
| 168 |
+
],
|
| 169 |
+
"box": [
|
| 170 |
+
64,
|
| 171 |
+
8,
|
| 172 |
+
1,
|
| 173 |
+
1,
|
| 174 |
+
1
|
| 175 |
+
],
|
| 176 |
+
"swizzle": 128,
|
| 177 |
+
"l2_promotion": 128
|
| 178 |
+
}
|
| 179 |
+
},
|
| 180 |
+
{
|
| 181 |
+
"at": 912,
|
| 182 |
+
"param": 0
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"at": 1000,
|
| 186 |
+
"param": 4
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"at": 1080,
|
| 190 |
+
"param": 5
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"at": 1116,
|
| 194 |
+
"param": 7
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"at": 1244,
|
| 198 |
+
"param": 8
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"at": 1112,
|
| 202 |
+
"i32": 2147483647
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"at": 1144,
|
| 206 |
+
"i32": 1
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"at": 1148,
|
| 210 |
+
"i32": 262144
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"at": 1152,
|
| 214 |
+
"i32": 1
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"at": 1156,
|
| 218 |
+
"i32": 38
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"at": 1160,
|
| 222 |
+
"i32": 4096
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"at": 1164,
|
| 226 |
+
"i32": 4
|
| 227 |
+
},
|
| 228 |
+
{
|
| 229 |
+
"at": 1168,
|
| 230 |
+
"i32": 24
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"at": 1172,
|
| 234 |
+
"i32": 6
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"at": 1176,
|
| 238 |
+
"i32": 6
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"at": 1180,
|
| 242 |
+
"i32": -1431655765
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"at": 1188,
|
| 246 |
+
"i32": 2
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"at": 1192,
|
| 250 |
+
"i32": 6144
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"at": 1200,
|
| 254 |
+
"i32": 1048576
|
| 255 |
+
},
|
| 256 |
+
{
|
| 257 |
+
"at": 1204,
|
| 258 |
+
"i32": 1
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"at": 1208,
|
| 262 |
+
"i32": 6
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"at": 1212,
|
| 266 |
+
"i32": 1
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"at": 1216,
|
| 270 |
+
"i32": 1065353216
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"at": 1220,
|
| 274 |
+
"i32": 1035512379
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"at": 1224,
|
| 278 |
+
"i32": 1065353216
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"at": 1228,
|
| 282 |
+
"i32": -1082130432
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"at": 1252,
|
| 286 |
+
"i32": 256
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"at": 984,
|
| 290 |
+
"scratch": "counter"
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"at": 1008,
|
| 294 |
+
"scratch": "partial"
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"at": 1016,
|
| 298 |
+
"scratch": "stats"
|
| 299 |
+
}
|
| 300 |
+
]
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
]
|
| 304 |
+
}
|
| 305 |
+
]
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
}
|
| 309 |
+
}
|
examples/decode.json
ADDED
|
@@ -0,0 +1,418 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 4,
|
| 3 |
+
"model": "trtllm-gen-decode-example",
|
| 4 |
+
"vars": {
|
| 5 |
+
"tokens": {
|
| 6 |
+
"max": 64
|
| 7 |
+
},
|
| 8 |
+
"seqs": {
|
| 9 |
+
"max": 2
|
| 10 |
+
}
|
| 11 |
+
},
|
| 12 |
+
"buffers": {
|
| 13 |
+
"q": {
|
| 14 |
+
"dtype": "bf16",
|
| 15 |
+
"shape": [
|
| 16 |
+
64,
|
| 17 |
+
24,
|
| 18 |
+
256
|
| 19 |
+
],
|
| 20 |
+
"kind": "input"
|
| 21 |
+
},
|
| 22 |
+
"out": {
|
| 23 |
+
"dtype": "bf16",
|
| 24 |
+
"shape": [
|
| 25 |
+
64,
|
| 26 |
+
24,
|
| 27 |
+
256
|
| 28 |
+
],
|
| 29 |
+
"kind": "output"
|
| 30 |
+
},
|
| 31 |
+
"kv": {
|
| 32 |
+
"dtype": "bf16",
|
| 33 |
+
"shape": [
|
| 34 |
+
22,
|
| 35 |
+
2,
|
| 36 |
+
64,
|
| 37 |
+
4,
|
| 38 |
+
2,
|
| 39 |
+
256
|
| 40 |
+
],
|
| 41 |
+
"kind": "input"
|
| 42 |
+
},
|
| 43 |
+
"table": {
|
| 44 |
+
"dtype": "i32",
|
| 45 |
+
"shape": [
|
| 46 |
+
2,
|
| 47 |
+
11
|
| 48 |
+
],
|
| 49 |
+
"kind": "input"
|
| 50 |
+
},
|
| 51 |
+
"seq": {
|
| 52 |
+
"dtype": "i32",
|
| 53 |
+
"shape": [
|
| 54 |
+
2
|
| 55 |
+
],
|
| 56 |
+
"kind": "input"
|
| 57 |
+
},
|
| 58 |
+
"cuq": {
|
| 59 |
+
"dtype": "i32",
|
| 60 |
+
"shape": [
|
| 61 |
+
3
|
| 62 |
+
],
|
| 63 |
+
"kind": "input"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"modules": {
|
| 67 |
+
"fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen": {
|
| 68 |
+
"source": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen.cubin",
|
| 69 |
+
"sha256": "a5c3300d05153675d2c6c432c50be888f3e0a8bb6c3ffbdaed48fbb25e52f86e"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"ops": {
|
| 73 |
+
"decode": {
|
| 74 |
+
"params": [
|
| 75 |
+
"out buffer<bf16>",
|
| 76 |
+
"in buffer<bf16>",
|
| 77 |
+
"in buffer<bf16>",
|
| 78 |
+
"in buffer<bf16>",
|
| 79 |
+
"in buffer<i32>",
|
| 80 |
+
"in buffer<i32>",
|
| 81 |
+
"in buffer<i32>",
|
| 82 |
+
"i32",
|
| 83 |
+
"i32"
|
| 84 |
+
],
|
| 85 |
+
"impl": {
|
| 86 |
+
"scratch": {
|
| 87 |
+
"counter": {
|
| 88 |
+
"dtype": "i32",
|
| 89 |
+
"shape": [
|
| 90 |
+
48
|
| 91 |
+
]
|
| 92 |
+
},
|
| 93 |
+
"stats": {
|
| 94 |
+
"dtype": "f32",
|
| 95 |
+
"shape": [
|
| 96 |
+
2,
|
| 97 |
+
4,
|
| 98 |
+
38,
|
| 99 |
+
8,
|
| 100 |
+
2
|
| 101 |
+
]
|
| 102 |
+
},
|
| 103 |
+
"partial": {
|
| 104 |
+
"dtype": "f32",
|
| 105 |
+
"shape": [
|
| 106 |
+
2,
|
| 107 |
+
4,
|
| 108 |
+
38,
|
| 109 |
+
8,
|
| 110 |
+
256
|
| 111 |
+
]
|
| 112 |
+
}
|
| 113 |
+
},
|
| 114 |
+
"launches": [
|
| 115 |
+
{
|
| 116 |
+
"module": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen",
|
| 117 |
+
"entry": "fmhaSm100fKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64MultiCtasKvVarSeqQ8Kv128StaticSwapsAbForGen",
|
| 118 |
+
"params": [
|
| 119 |
+
"bytes<1280>"
|
| 120 |
+
],
|
| 121 |
+
"block": [
|
| 122 |
+
512,
|
| 123 |
+
1,
|
| 124 |
+
1
|
| 125 |
+
],
|
| 126 |
+
"grid": [
|
| 127 |
+
38,
|
| 128 |
+
4,
|
| 129 |
+
"seqs"
|
| 130 |
+
],
|
| 131 |
+
"shared_mem": 144992,
|
| 132 |
+
"args": [
|
| 133 |
+
{
|
| 134 |
+
"pack": {
|
| 135 |
+
"size": 1280,
|
| 136 |
+
"fields": [
|
| 137 |
+
{
|
| 138 |
+
"at": 0,
|
| 139 |
+
"tensormap": {
|
| 140 |
+
"param": 1,
|
| 141 |
+
"dtype": "bf16",
|
| 142 |
+
"dims": [
|
| 143 |
+
256,
|
| 144 |
+
6,
|
| 145 |
+
4,
|
| 146 |
+
64
|
| 147 |
+
],
|
| 148 |
+
"strides": [
|
| 149 |
+
512,
|
| 150 |
+
3072,
|
| 151 |
+
12288
|
| 152 |
+
],
|
| 153 |
+
"box": [
|
| 154 |
+
64,
|
| 155 |
+
6,
|
| 156 |
+
1,
|
| 157 |
+
1
|
| 158 |
+
],
|
| 159 |
+
"swizzle": 128,
|
| 160 |
+
"l2_promotion": 128
|
| 161 |
+
}
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"at": 128,
|
| 165 |
+
"tensormap": {
|
| 166 |
+
"param": 2,
|
| 167 |
+
"dtype": "bf16",
|
| 168 |
+
"dims": [
|
| 169 |
+
256,
|
| 170 |
+
64,
|
| 171 |
+
4,
|
| 172 |
+
0
|
| 173 |
+
],
|
| 174 |
+
"strides": [
|
| 175 |
+
4096,
|
| 176 |
+
1024,
|
| 177 |
+
524288
|
| 178 |
+
],
|
| 179 |
+
"box": [
|
| 180 |
+
64,
|
| 181 |
+
64,
|
| 182 |
+
1,
|
| 183 |
+
1
|
| 184 |
+
],
|
| 185 |
+
"swizzle": 128,
|
| 186 |
+
"l2_promotion": 128
|
| 187 |
+
}
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"at": 384,
|
| 191 |
+
"tensormap": {
|
| 192 |
+
"param": 3,
|
| 193 |
+
"dtype": "bf16",
|
| 194 |
+
"dims": [
|
| 195 |
+
256,
|
| 196 |
+
64,
|
| 197 |
+
4,
|
| 198 |
+
0
|
| 199 |
+
],
|
| 200 |
+
"strides": [
|
| 201 |
+
4096,
|
| 202 |
+
1024,
|
| 203 |
+
524288
|
| 204 |
+
],
|
| 205 |
+
"box": [
|
| 206 |
+
64,
|
| 207 |
+
64,
|
| 208 |
+
1,
|
| 209 |
+
1
|
| 210 |
+
],
|
| 211 |
+
"swizzle": 128,
|
| 212 |
+
"l2_promotion": 128
|
| 213 |
+
}
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"at": 512,
|
| 217 |
+
"tensormap": {
|
| 218 |
+
"param": 0,
|
| 219 |
+
"dtype": "bf16",
|
| 220 |
+
"dims": [
|
| 221 |
+
256,
|
| 222 |
+
64,
|
| 223 |
+
4,
|
| 224 |
+
6,
|
| 225 |
+
1
|
| 226 |
+
],
|
| 227 |
+
"strides": [
|
| 228 |
+
12288,
|
| 229 |
+
512,
|
| 230 |
+
2048,
|
| 231 |
+
16
|
| 232 |
+
],
|
| 233 |
+
"box": [
|
| 234 |
+
64,
|
| 235 |
+
8,
|
| 236 |
+
1,
|
| 237 |
+
1,
|
| 238 |
+
1
|
| 239 |
+
],
|
| 240 |
+
"swizzle": 128,
|
| 241 |
+
"l2_promotion": 128
|
| 242 |
+
}
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
"at": 912,
|
| 246 |
+
"param": 0
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"at": 1000,
|
| 250 |
+
"param": 4
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"at": 1080,
|
| 254 |
+
"param": 5
|
| 255 |
+
},
|
| 256 |
+
{
|
| 257 |
+
"at": 1116,
|
| 258 |
+
"param": 7
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"at": 1244,
|
| 262 |
+
"param": 8
|
| 263 |
+
},
|
| 264 |
+
{
|
| 265 |
+
"at": 1112,
|
| 266 |
+
"i32": 2147483647
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"at": 1144,
|
| 270 |
+
"i32": 1
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"at": 1148,
|
| 274 |
+
"i32": 704
|
| 275 |
+
},
|
| 276 |
+
{
|
| 277 |
+
"at": 1152,
|
| 278 |
+
"i32": 1
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"at": 1156,
|
| 282 |
+
"i32": 38
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"at": 1160,
|
| 286 |
+
"i32": 11
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"at": 1164,
|
| 290 |
+
"i32": 4
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"at": 1168,
|
| 294 |
+
"i32": 24
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"at": 1172,
|
| 298 |
+
"i32": 6
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"at": 1176,
|
| 302 |
+
"i32": 6
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"at": 1180,
|
| 306 |
+
"i32": -1431655765
|
| 307 |
+
},
|
| 308 |
+
{
|
| 309 |
+
"at": 1188,
|
| 310 |
+
"i32": 2
|
| 311 |
+
},
|
| 312 |
+
{
|
| 313 |
+
"at": 1192,
|
| 314 |
+
"i32": 6144
|
| 315 |
+
},
|
| 316 |
+
{
|
| 317 |
+
"at": 1200,
|
| 318 |
+
"i32": 44
|
| 319 |
+
},
|
| 320 |
+
{
|
| 321 |
+
"at": 1204,
|
| 322 |
+
"i32": 1
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"at": 1208,
|
| 326 |
+
"i32": 6
|
| 327 |
+
},
|
| 328 |
+
{
|
| 329 |
+
"at": 1212,
|
| 330 |
+
"i32": 1
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"at": 1216,
|
| 334 |
+
"i32": 1065353216
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"at": 1220,
|
| 338 |
+
"i32": 1035512379
|
| 339 |
+
},
|
| 340 |
+
{
|
| 341 |
+
"at": 1224,
|
| 342 |
+
"i32": 1065353216
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"at": 1228,
|
| 346 |
+
"i32": -1082130432
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"at": 1252,
|
| 350 |
+
"i32": 256
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"at": 984,
|
| 354 |
+
"scratch": "counter"
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"at": 1008,
|
| 358 |
+
"scratch": "partial"
|
| 359 |
+
},
|
| 360 |
+
{
|
| 361 |
+
"at": 1016,
|
| 362 |
+
"scratch": "stats"
|
| 363 |
+
}
|
| 364 |
+
]
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
]
|
| 368 |
+
}
|
| 369 |
+
]
|
| 370 |
+
}
|
| 371 |
+
}
|
| 372 |
+
},
|
| 373 |
+
"programs": {
|
| 374 |
+
"decode": {
|
| 375 |
+
"batch": {
|
| 376 |
+
"groups": 2,
|
| 377 |
+
"rows": 1
|
| 378 |
+
},
|
| 379 |
+
"calls": [
|
| 380 |
+
{
|
| 381 |
+
"label": "attention",
|
| 382 |
+
"op": "decode",
|
| 383 |
+
"args": [
|
| 384 |
+
{
|
| 385 |
+
"buf": "out"
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"buf": "q"
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"buf": "kv",
|
| 392 |
+
"offset": 262144
|
| 393 |
+
},
|
| 394 |
+
{
|
| 395 |
+
"buf": "kv",
|
| 396 |
+
"offset": 262656
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"buf": "table"
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"buf": "seq"
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"buf": "cuq"
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"var": "seqs"
|
| 409 |
+
},
|
| 410 |
+
{
|
| 411 |
+
"var": "tokens"
|
| 412 |
+
}
|
| 413 |
+
]
|
| 414 |
+
}
|
| 415 |
+
]
|
| 416 |
+
}
|
| 417 |
+
}
|
| 418 |
+
}
|
examples/prefill-ops.json
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"modules": {
|
| 3 |
+
"fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext": {
|
| 4 |
+
"source": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext.cubin",
|
| 5 |
+
"sha256": "270e5246cd40181234f075ae4e05e0e53fbe662e46640807b44daf272cd5aed7"
|
| 6 |
+
}
|
| 7 |
+
},
|
| 8 |
+
"ops": {
|
| 9 |
+
"attn_prefill": {
|
| 10 |
+
"params": [
|
| 11 |
+
"out buffer<bf16>",
|
| 12 |
+
"in buffer<bf16>",
|
| 13 |
+
"in state",
|
| 14 |
+
"in state",
|
| 15 |
+
"in buffer<i32>",
|
| 16 |
+
"in buffer<i32>",
|
| 17 |
+
"in buffer<i32>",
|
| 18 |
+
"i32",
|
| 19 |
+
"i32"
|
| 20 |
+
],
|
| 21 |
+
"impl": {
|
| 22 |
+
"scratch": {},
|
| 23 |
+
"launches": [
|
| 24 |
+
{
|
| 25 |
+
"module": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 26 |
+
"entry": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 27 |
+
"params": [
|
| 28 |
+
"bytes<1280>"
|
| 29 |
+
],
|
| 30 |
+
"block": [
|
| 31 |
+
384,
|
| 32 |
+
1,
|
| 33 |
+
1
|
| 34 |
+
],
|
| 35 |
+
"grid": [
|
| 36 |
+
{
|
| 37 |
+
"ceil_div": [
|
| 38 |
+
"tokens",
|
| 39 |
+
128
|
| 40 |
+
]
|
| 41 |
+
},
|
| 42 |
+
24,
|
| 43 |
+
"seqs"
|
| 44 |
+
],
|
| 45 |
+
"shared_mem": 197872,
|
| 46 |
+
"args": [
|
| 47 |
+
{
|
| 48 |
+
"pack": {
|
| 49 |
+
"size": 1280,
|
| 50 |
+
"fields": [
|
| 51 |
+
{
|
| 52 |
+
"at": 0,
|
| 53 |
+
"tensormap": {
|
| 54 |
+
"param": 1,
|
| 55 |
+
"dtype": "bf16",
|
| 56 |
+
"dims": [
|
| 57 |
+
256,
|
| 58 |
+
1,
|
| 59 |
+
24,
|
| 60 |
+
2048
|
| 61 |
+
],
|
| 62 |
+
"strides": [
|
| 63 |
+
512,
|
| 64 |
+
512,
|
| 65 |
+
12288
|
| 66 |
+
],
|
| 67 |
+
"box": [
|
| 68 |
+
64,
|
| 69 |
+
1,
|
| 70 |
+
1,
|
| 71 |
+
128
|
| 72 |
+
],
|
| 73 |
+
"swizzle": 128,
|
| 74 |
+
"l2_promotion": 128
|
| 75 |
+
}
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"at": 128,
|
| 79 |
+
"tensormap": {
|
| 80 |
+
"param": 2,
|
| 81 |
+
"dtype": "bf16",
|
| 82 |
+
"dims": [
|
| 83 |
+
256,
|
| 84 |
+
64,
|
| 85 |
+
4,
|
| 86 |
+
0
|
| 87 |
+
],
|
| 88 |
+
"strides": [
|
| 89 |
+
4096,
|
| 90 |
+
1024,
|
| 91 |
+
4194304
|
| 92 |
+
],
|
| 93 |
+
"box": [
|
| 94 |
+
64,
|
| 95 |
+
64,
|
| 96 |
+
1,
|
| 97 |
+
1
|
| 98 |
+
],
|
| 99 |
+
"swizzle": 128,
|
| 100 |
+
"l2_promotion": 128
|
| 101 |
+
}
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"at": 384,
|
| 105 |
+
"tensormap": {
|
| 106 |
+
"param": 3,
|
| 107 |
+
"dtype": "bf16",
|
| 108 |
+
"dims": [
|
| 109 |
+
256,
|
| 110 |
+
64,
|
| 111 |
+
4,
|
| 112 |
+
0
|
| 113 |
+
],
|
| 114 |
+
"strides": [
|
| 115 |
+
4096,
|
| 116 |
+
1024,
|
| 117 |
+
4194304
|
| 118 |
+
],
|
| 119 |
+
"box": [
|
| 120 |
+
64,
|
| 121 |
+
64,
|
| 122 |
+
1,
|
| 123 |
+
1
|
| 124 |
+
],
|
| 125 |
+
"swizzle": 128,
|
| 126 |
+
"l2_promotion": 128
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"at": 512,
|
| 131 |
+
"tensormap": {
|
| 132 |
+
"param": 0,
|
| 133 |
+
"dtype": "bf16",
|
| 134 |
+
"dims": [
|
| 135 |
+
256,
|
| 136 |
+
2048,
|
| 137 |
+
4,
|
| 138 |
+
6,
|
| 139 |
+
1
|
| 140 |
+
],
|
| 141 |
+
"strides": [
|
| 142 |
+
12288,
|
| 143 |
+
512,
|
| 144 |
+
2048,
|
| 145 |
+
16
|
| 146 |
+
],
|
| 147 |
+
"box": [
|
| 148 |
+
64,
|
| 149 |
+
128,
|
| 150 |
+
1,
|
| 151 |
+
1,
|
| 152 |
+
1
|
| 153 |
+
],
|
| 154 |
+
"swizzle": 128,
|
| 155 |
+
"l2_promotion": 128
|
| 156 |
+
}
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"at": 912,
|
| 160 |
+
"param": 0
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"at": 1000,
|
| 164 |
+
"param": 4
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"at": 1080,
|
| 168 |
+
"param": 5
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"at": 1116,
|
| 172 |
+
"param": 7
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"at": 1244,
|
| 176 |
+
"param": 8
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"at": 936,
|
| 180 |
+
"param": 6
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"at": 1144,
|
| 184 |
+
"param": 8
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"at": 1152,
|
| 188 |
+
"expr": {
|
| 189 |
+
"ceil_div": [
|
| 190 |
+
"tokens",
|
| 191 |
+
128
|
| 192 |
+
]
|
| 193 |
+
}
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"at": 1112,
|
| 197 |
+
"i32": 2147483647
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"at": 1148,
|
| 201 |
+
"i32": 262144
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"at": 1156,
|
| 205 |
+
"i32": 1
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"at": 1160,
|
| 209 |
+
"i32": 4096
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"at": 1164,
|
| 213 |
+
"i32": 4
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"at": 1168,
|
| 217 |
+
"i32": 24
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"at": 1172,
|
| 221 |
+
"i32": 6
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"at": 1176,
|
| 225 |
+
"i32": 6
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"at": 1180,
|
| 229 |
+
"i32": -1431655765
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"at": 1188,
|
| 233 |
+
"i32": 2
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"at": 1192,
|
| 237 |
+
"i32": 6144
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"at": 1200,
|
| 241 |
+
"i32": 1048576
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"at": 1204,
|
| 245 |
+
"i32": 128
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"at": 1208,
|
| 249 |
+
"i32": 6
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"at": 1212,
|
| 253 |
+
"i32": 1
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"at": 1216,
|
| 257 |
+
"i32": 1065353216
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"at": 1220,
|
| 261 |
+
"i32": 1035512379
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"at": 1224,
|
| 265 |
+
"i32": 1065353216
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"at": 1228,
|
| 269 |
+
"i32": -1082130432
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"at": 1252,
|
| 273 |
+
"i32": 256
|
| 274 |
+
}
|
| 275 |
+
]
|
| 276 |
+
}
|
| 277 |
+
}
|
| 278 |
+
]
|
| 279 |
+
}
|
| 280 |
+
]
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
}
|
examples/prefill.json
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 4,
|
| 3 |
+
"model": "trtllm-gen-prefill-example",
|
| 4 |
+
"vars": {
|
| 5 |
+
"tokens": {
|
| 6 |
+
"max": 258
|
| 7 |
+
},
|
| 8 |
+
"seqs": {
|
| 9 |
+
"max": 2
|
| 10 |
+
}
|
| 11 |
+
},
|
| 12 |
+
"buffers": {
|
| 13 |
+
"q": {
|
| 14 |
+
"dtype": "bf16",
|
| 15 |
+
"shape": [
|
| 16 |
+
258,
|
| 17 |
+
24,
|
| 18 |
+
256
|
| 19 |
+
],
|
| 20 |
+
"kind": "input"
|
| 21 |
+
},
|
| 22 |
+
"out": {
|
| 23 |
+
"dtype": "bf16",
|
| 24 |
+
"shape": [
|
| 25 |
+
258,
|
| 26 |
+
24,
|
| 27 |
+
256
|
| 28 |
+
],
|
| 29 |
+
"kind": "output"
|
| 30 |
+
},
|
| 31 |
+
"kv": {
|
| 32 |
+
"dtype": "bf16",
|
| 33 |
+
"shape": [
|
| 34 |
+
22,
|
| 35 |
+
2,
|
| 36 |
+
64,
|
| 37 |
+
4,
|
| 38 |
+
2,
|
| 39 |
+
256
|
| 40 |
+
],
|
| 41 |
+
"kind": "input"
|
| 42 |
+
},
|
| 43 |
+
"table": {
|
| 44 |
+
"dtype": "i32",
|
| 45 |
+
"shape": [
|
| 46 |
+
2,
|
| 47 |
+
11
|
| 48 |
+
],
|
| 49 |
+
"kind": "input"
|
| 50 |
+
},
|
| 51 |
+
"seq": {
|
| 52 |
+
"dtype": "i32",
|
| 53 |
+
"shape": [
|
| 54 |
+
2
|
| 55 |
+
],
|
| 56 |
+
"kind": "input"
|
| 57 |
+
},
|
| 58 |
+
"cuq": {
|
| 59 |
+
"dtype": "i32",
|
| 60 |
+
"shape": [
|
| 61 |
+
3
|
| 62 |
+
],
|
| 63 |
+
"kind": "input"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"modules": {
|
| 67 |
+
"fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext": {
|
| 68 |
+
"source": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext.cubin",
|
| 69 |
+
"sha256": "270e5246cd40181234f075ae4e05e0e53fbe662e46640807b44daf272cd5aed7"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"ops": {
|
| 73 |
+
"prefill": {
|
| 74 |
+
"params": [
|
| 75 |
+
"out buffer<bf16>",
|
| 76 |
+
"in buffer<bf16>",
|
| 77 |
+
"in buffer<bf16>",
|
| 78 |
+
"in buffer<bf16>",
|
| 79 |
+
"in buffer<i32>",
|
| 80 |
+
"in buffer<i32>",
|
| 81 |
+
"in buffer<i32>",
|
| 82 |
+
"i32",
|
| 83 |
+
"i32"
|
| 84 |
+
],
|
| 85 |
+
"impl": {
|
| 86 |
+
"scratch": {},
|
| 87 |
+
"launches": [
|
| 88 |
+
{
|
| 89 |
+
"module": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 90 |
+
"entry": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 91 |
+
"params": [
|
| 92 |
+
"bytes<1280>"
|
| 93 |
+
],
|
| 94 |
+
"block": [
|
| 95 |
+
384,
|
| 96 |
+
1,
|
| 97 |
+
1
|
| 98 |
+
],
|
| 99 |
+
"grid": [
|
| 100 |
+
{
|
| 101 |
+
"ceil_div": [
|
| 102 |
+
"tokens",
|
| 103 |
+
128
|
| 104 |
+
]
|
| 105 |
+
},
|
| 106 |
+
24,
|
| 107 |
+
"seqs"
|
| 108 |
+
],
|
| 109 |
+
"shared_mem": 197872,
|
| 110 |
+
"args": [
|
| 111 |
+
{
|
| 112 |
+
"pack": {
|
| 113 |
+
"size": 1280,
|
| 114 |
+
"fields": [
|
| 115 |
+
{
|
| 116 |
+
"at": 0,
|
| 117 |
+
"tensormap": {
|
| 118 |
+
"param": 1,
|
| 119 |
+
"dtype": "bf16",
|
| 120 |
+
"dims": [
|
| 121 |
+
256,
|
| 122 |
+
1,
|
| 123 |
+
24,
|
| 124 |
+
258
|
| 125 |
+
],
|
| 126 |
+
"strides": [
|
| 127 |
+
512,
|
| 128 |
+
512,
|
| 129 |
+
12288
|
| 130 |
+
],
|
| 131 |
+
"box": [
|
| 132 |
+
64,
|
| 133 |
+
1,
|
| 134 |
+
1,
|
| 135 |
+
128
|
| 136 |
+
],
|
| 137 |
+
"swizzle": 128,
|
| 138 |
+
"l2_promotion": 128
|
| 139 |
+
}
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"at": 128,
|
| 143 |
+
"tensormap": {
|
| 144 |
+
"param": 2,
|
| 145 |
+
"dtype": "bf16",
|
| 146 |
+
"dims": [
|
| 147 |
+
256,
|
| 148 |
+
64,
|
| 149 |
+
4,
|
| 150 |
+
0
|
| 151 |
+
],
|
| 152 |
+
"strides": [
|
| 153 |
+
4096,
|
| 154 |
+
1024,
|
| 155 |
+
524288
|
| 156 |
+
],
|
| 157 |
+
"box": [
|
| 158 |
+
64,
|
| 159 |
+
64,
|
| 160 |
+
1,
|
| 161 |
+
1
|
| 162 |
+
],
|
| 163 |
+
"swizzle": 128,
|
| 164 |
+
"l2_promotion": 128
|
| 165 |
+
}
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"at": 384,
|
| 169 |
+
"tensormap": {
|
| 170 |
+
"param": 3,
|
| 171 |
+
"dtype": "bf16",
|
| 172 |
+
"dims": [
|
| 173 |
+
256,
|
| 174 |
+
64,
|
| 175 |
+
4,
|
| 176 |
+
0
|
| 177 |
+
],
|
| 178 |
+
"strides": [
|
| 179 |
+
4096,
|
| 180 |
+
1024,
|
| 181 |
+
524288
|
| 182 |
+
],
|
| 183 |
+
"box": [
|
| 184 |
+
64,
|
| 185 |
+
64,
|
| 186 |
+
1,
|
| 187 |
+
1
|
| 188 |
+
],
|
| 189 |
+
"swizzle": 128,
|
| 190 |
+
"l2_promotion": 128
|
| 191 |
+
}
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"at": 512,
|
| 195 |
+
"tensormap": {
|
| 196 |
+
"param": 0,
|
| 197 |
+
"dtype": "bf16",
|
| 198 |
+
"dims": [
|
| 199 |
+
256,
|
| 200 |
+
258,
|
| 201 |
+
4,
|
| 202 |
+
6,
|
| 203 |
+
1
|
| 204 |
+
],
|
| 205 |
+
"strides": [
|
| 206 |
+
12288,
|
| 207 |
+
512,
|
| 208 |
+
2048,
|
| 209 |
+
16
|
| 210 |
+
],
|
| 211 |
+
"box": [
|
| 212 |
+
64,
|
| 213 |
+
128,
|
| 214 |
+
1,
|
| 215 |
+
1,
|
| 216 |
+
1
|
| 217 |
+
],
|
| 218 |
+
"swizzle": 128,
|
| 219 |
+
"l2_promotion": 128
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"at": 912,
|
| 224 |
+
"param": 0
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
"at": 1000,
|
| 228 |
+
"param": 4
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"at": 1080,
|
| 232 |
+
"param": 5
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"at": 1116,
|
| 236 |
+
"param": 7
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"at": 1244,
|
| 240 |
+
"param": 8
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"at": 936,
|
| 244 |
+
"param": 6
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"at": 1144,
|
| 248 |
+
"param": 8
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
"at": 1152,
|
| 252 |
+
"expr": {
|
| 253 |
+
"ceil_div": [
|
| 254 |
+
"tokens",
|
| 255 |
+
128
|
| 256 |
+
]
|
| 257 |
+
}
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"at": 1112,
|
| 261 |
+
"i32": 2147483647
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"at": 1148,
|
| 265 |
+
"i32": 704
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"at": 1156,
|
| 269 |
+
"i32": 1
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"at": 1160,
|
| 273 |
+
"i32": 11
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"at": 1164,
|
| 277 |
+
"i32": 4
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"at": 1168,
|
| 281 |
+
"i32": 24
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"at": 1172,
|
| 285 |
+
"i32": 6
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"at": 1176,
|
| 289 |
+
"i32": 6
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"at": 1180,
|
| 293 |
+
"i32": -1431655765
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"at": 1188,
|
| 297 |
+
"i32": 2
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"at": 1192,
|
| 301 |
+
"i32": 6144
|
| 302 |
+
},
|
| 303 |
+
{
|
| 304 |
+
"at": 1200,
|
| 305 |
+
"i32": 44
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"at": 1204,
|
| 309 |
+
"i32": 128
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"at": 1208,
|
| 313 |
+
"i32": 6
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"at": 1212,
|
| 317 |
+
"i32": 1
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"at": 1216,
|
| 321 |
+
"i32": 1065353216
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"at": 1220,
|
| 325 |
+
"i32": 1035512379
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"at": 1224,
|
| 329 |
+
"i32": 1065353216
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"at": 1228,
|
| 333 |
+
"i32": -1082130432
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"at": 1252,
|
| 337 |
+
"i32": 256
|
| 338 |
+
}
|
| 339 |
+
]
|
| 340 |
+
}
|
| 341 |
+
}
|
| 342 |
+
]
|
| 343 |
+
}
|
| 344 |
+
]
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
},
|
| 348 |
+
"programs": {
|
| 349 |
+
"prefill": {
|
| 350 |
+
"batch": {
|
| 351 |
+
"groups": 2,
|
| 352 |
+
"rows": 129
|
| 353 |
+
},
|
| 354 |
+
"calls": [
|
| 355 |
+
{
|
| 356 |
+
"label": "attention",
|
| 357 |
+
"op": "prefill",
|
| 358 |
+
"args": [
|
| 359 |
+
{
|
| 360 |
+
"buf": "out"
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"buf": "q"
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"buf": "kv",
|
| 367 |
+
"offset": 262144
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"buf": "kv",
|
| 371 |
+
"offset": 262656
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"buf": "table"
|
| 375 |
+
},
|
| 376 |
+
{
|
| 377 |
+
"buf": "seq"
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"buf": "cuq"
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"var": "seqs"
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"var": "tokens"
|
| 387 |
+
}
|
| 388 |
+
]
|
| 389 |
+
}
|
| 390 |
+
]
|
| 391 |
+
}
|
| 392 |
+
}
|
| 393 |
+
}
|
examples/run_examples.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Run all three downloaded JSON examples against FlashInfer, without weights."""
|
| 3 |
+
import argparse
|
| 4 |
+
import json
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import subprocess
|
| 7 |
+
import tempfile
|
| 8 |
+
|
| 9 |
+
import flashinfer
|
| 10 |
+
import torch
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def main():
|
| 14 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 15 |
+
parser.add_argument('--runner', type=Path, required=True)
|
| 16 |
+
parser.add_argument('--cubins', type=Path, required=True)
|
| 17 |
+
parser.add_argument('--gpu', type=int, default=0)
|
| 18 |
+
parser.add_argument('--output', type=Path, default=Path('example-results.json'))
|
| 19 |
+
args = parser.parse_args()
|
| 20 |
+
torch.cuda.set_device(args.gpu)
|
| 21 |
+
torch.set_grad_enabled(False)
|
| 22 |
+
torch.manual_seed(20260907)
|
| 23 |
+
directory = Path(__file__).resolve().parent
|
| 24 |
+
results = []
|
| 25 |
+
for name, qlen in [('decode', 1), ('prefill', 129), ('verify', 8)]:
|
| 26 |
+
manifest_path = directory / f'{name}.json'
|
| 27 |
+
manifest = json.loads(manifest_path.read_text())
|
| 28 |
+
q = torch.randn(manifest['buffers']['q']['shape'], device='cuda', dtype=torch.bfloat16)
|
| 29 |
+
kv = torch.randn(22, 2, 64, 4, 2, 256, device='cuda', dtype=torch.bfloat16)
|
| 30 |
+
table = torch.randperm(22, device='cuda', dtype=torch.int32).view(2, 11)
|
| 31 |
+
seq = torch.tensor([385, 641], device='cuda', dtype=torch.int32)
|
| 32 |
+
cuq = torch.arange(3, device='cuda', dtype=torch.int32) * qlen
|
| 33 |
+
cuk = torch.tensor([0, 385, 1026], device='cuda', dtype=torch.int32)
|
| 34 |
+
workspace = torch.zeros(256 * 1024 * 1024, device='cuda', dtype=torch.uint8)
|
| 35 |
+
common = dict(query=q[:2 * qlen], kv_cache=(kv[:, 1, :, :, 0], kv[:, 1, :, :, 1]),
|
| 36 |
+
workspace_buffer=workspace, block_tables=table, seq_lens=seq,
|
| 37 |
+
bmm1_scale=1 / 16, bmm2_scale=1., kv_layout='NHD', enable_pdl=False)
|
| 38 |
+
if name == 'decode':
|
| 39 |
+
expected = flashinfer.decode.trtllm_batch_decode_with_kv_cache(
|
| 40 |
+
**common, max_seq_len=641, backend='trtllm-gen')
|
| 41 |
+
else:
|
| 42 |
+
expected = flashinfer.prefill.trtllm_batch_context_with_kv_cache(
|
| 43 |
+
**common, max_q_len=qlen, max_kv_len=641, batch_size=2,
|
| 44 |
+
cum_seq_lens_q=cuq, cum_seq_lens_kv=cuk, causal=True)
|
| 45 |
+
expected = expected.cpu().float()
|
| 46 |
+
with tempfile.TemporaryDirectory() as tmp:
|
| 47 |
+
tmp = Path(tmp)
|
| 48 |
+
cmd = [str(args.runner.resolve()), '--gpu', str(args.gpu),
|
| 49 |
+
'--manifest', str(manifest_path), '--cubins', str(args.cubins.resolve()),
|
| 50 |
+
'--env', 'seqs=2', '--env', f'tokens={2 * qlen}', '--graph', '--iters', '9',
|
| 51 |
+
'--out', f'out={tmp}/out.bin']
|
| 52 |
+
for key, tensor in dict(q=q, kv=kv, table=table, seq=seq, cuq=cuq).items():
|
| 53 |
+
(tmp / f'{key}.bin').write_bytes(tensor.contiguous().view(torch.uint8).cpu().numpy().tobytes())
|
| 54 |
+
cmd += ['--in', f'{key}={tmp}/{key}.bin']
|
| 55 |
+
completed = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
|
| 56 |
+
if completed.returncode:
|
| 57 |
+
raise RuntimeError(completed.stderr)
|
| 58 |
+
data = bytearray((tmp / 'out.bin').read_bytes())
|
| 59 |
+
actual = torch.frombuffer(data, dtype=torch.bfloat16)[:2 * qlen * 24 * 256].reshape_as(expected).float()
|
| 60 |
+
delta = actual - expected
|
| 61 |
+
relative_l2 = (delta.norm() / expected.norm().clamp_min(1e-12)).item()
|
| 62 |
+
max_abs = delta.abs().max().item()
|
| 63 |
+
passed = bool(torch.isfinite(actual).all()) and relative_l2 < .02 and max_abs < .02
|
| 64 |
+
row = dict(example=name, batch=2, query_tokens=qlen, passed=passed,
|
| 65 |
+
bit_exact=torch.equal(actual, expected), relative_l2=relative_l2, max_abs=max_abs)
|
| 66 |
+
print(json.dumps(row), flush=True)
|
| 67 |
+
results.append(row)
|
| 68 |
+
if not passed:
|
| 69 |
+
raise AssertionError(row)
|
| 70 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 71 |
+
args.output.write_text(json.dumps(results, indent=2) + '\n')
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
if __name__ == '__main__':
|
| 75 |
+
main()
|
examples/verify.json
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 4,
|
| 3 |
+
"model": "trtllm-gen-verify-example",
|
| 4 |
+
"vars": {
|
| 5 |
+
"tokens": {
|
| 6 |
+
"max": 64
|
| 7 |
+
},
|
| 8 |
+
"seqs": {
|
| 9 |
+
"max": 2
|
| 10 |
+
}
|
| 11 |
+
},
|
| 12 |
+
"buffers": {
|
| 13 |
+
"q": {
|
| 14 |
+
"dtype": "bf16",
|
| 15 |
+
"shape": [
|
| 16 |
+
64,
|
| 17 |
+
24,
|
| 18 |
+
256
|
| 19 |
+
],
|
| 20 |
+
"kind": "input"
|
| 21 |
+
},
|
| 22 |
+
"out": {
|
| 23 |
+
"dtype": "bf16",
|
| 24 |
+
"shape": [
|
| 25 |
+
64,
|
| 26 |
+
24,
|
| 27 |
+
256
|
| 28 |
+
],
|
| 29 |
+
"kind": "output"
|
| 30 |
+
},
|
| 31 |
+
"kv": {
|
| 32 |
+
"dtype": "bf16",
|
| 33 |
+
"shape": [
|
| 34 |
+
22,
|
| 35 |
+
2,
|
| 36 |
+
64,
|
| 37 |
+
4,
|
| 38 |
+
2,
|
| 39 |
+
256
|
| 40 |
+
],
|
| 41 |
+
"kind": "input"
|
| 42 |
+
},
|
| 43 |
+
"table": {
|
| 44 |
+
"dtype": "i32",
|
| 45 |
+
"shape": [
|
| 46 |
+
2,
|
| 47 |
+
11
|
| 48 |
+
],
|
| 49 |
+
"kind": "input"
|
| 50 |
+
},
|
| 51 |
+
"seq": {
|
| 52 |
+
"dtype": "i32",
|
| 53 |
+
"shape": [
|
| 54 |
+
2
|
| 55 |
+
],
|
| 56 |
+
"kind": "input"
|
| 57 |
+
},
|
| 58 |
+
"cuq": {
|
| 59 |
+
"dtype": "i32",
|
| 60 |
+
"shape": [
|
| 61 |
+
3
|
| 62 |
+
],
|
| 63 |
+
"kind": "input"
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
"modules": {
|
| 67 |
+
"fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext": {
|
| 68 |
+
"source": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext.cubin",
|
| 69 |
+
"sha256": "270e5246cd40181234f075ae4e05e0e53fbe662e46640807b44daf272cd5aed7"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"ops": {
|
| 73 |
+
"verify": {
|
| 74 |
+
"params": [
|
| 75 |
+
"out buffer<bf16>",
|
| 76 |
+
"in buffer<bf16>",
|
| 77 |
+
"in buffer<bf16>",
|
| 78 |
+
"in buffer<bf16>",
|
| 79 |
+
"in buffer<i32>",
|
| 80 |
+
"in buffer<i32>",
|
| 81 |
+
"in buffer<i32>",
|
| 82 |
+
"i32",
|
| 83 |
+
"i32"
|
| 84 |
+
],
|
| 85 |
+
"impl": {
|
| 86 |
+
"scratch": {},
|
| 87 |
+
"launches": [
|
| 88 |
+
{
|
| 89 |
+
"module": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 90 |
+
"entry": "fmhaSm103aKernel_QkvBfloat16OBfloat16H256PagedKvCausalP64VarSeqQ128Kv128PersistentContext",
|
| 91 |
+
"params": [
|
| 92 |
+
"bytes<1280>"
|
| 93 |
+
],
|
| 94 |
+
"block": [
|
| 95 |
+
384,
|
| 96 |
+
1,
|
| 97 |
+
1
|
| 98 |
+
],
|
| 99 |
+
"grid": [
|
| 100 |
+
{
|
| 101 |
+
"ceil_div": [
|
| 102 |
+
"tokens",
|
| 103 |
+
128
|
| 104 |
+
]
|
| 105 |
+
},
|
| 106 |
+
24,
|
| 107 |
+
"seqs"
|
| 108 |
+
],
|
| 109 |
+
"shared_mem": 197872,
|
| 110 |
+
"args": [
|
| 111 |
+
{
|
| 112 |
+
"pack": {
|
| 113 |
+
"size": 1280,
|
| 114 |
+
"fields": [
|
| 115 |
+
{
|
| 116 |
+
"at": 0,
|
| 117 |
+
"tensormap": {
|
| 118 |
+
"param": 1,
|
| 119 |
+
"dtype": "bf16",
|
| 120 |
+
"dims": [
|
| 121 |
+
256,
|
| 122 |
+
1,
|
| 123 |
+
24,
|
| 124 |
+
64
|
| 125 |
+
],
|
| 126 |
+
"strides": [
|
| 127 |
+
512,
|
| 128 |
+
512,
|
| 129 |
+
12288
|
| 130 |
+
],
|
| 131 |
+
"box": [
|
| 132 |
+
64,
|
| 133 |
+
1,
|
| 134 |
+
1,
|
| 135 |
+
128
|
| 136 |
+
],
|
| 137 |
+
"swizzle": 128,
|
| 138 |
+
"l2_promotion": 128
|
| 139 |
+
}
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"at": 128,
|
| 143 |
+
"tensormap": {
|
| 144 |
+
"param": 2,
|
| 145 |
+
"dtype": "bf16",
|
| 146 |
+
"dims": [
|
| 147 |
+
256,
|
| 148 |
+
64,
|
| 149 |
+
4,
|
| 150 |
+
0
|
| 151 |
+
],
|
| 152 |
+
"strides": [
|
| 153 |
+
4096,
|
| 154 |
+
1024,
|
| 155 |
+
524288
|
| 156 |
+
],
|
| 157 |
+
"box": [
|
| 158 |
+
64,
|
| 159 |
+
64,
|
| 160 |
+
1,
|
| 161 |
+
1
|
| 162 |
+
],
|
| 163 |
+
"swizzle": 128,
|
| 164 |
+
"l2_promotion": 128
|
| 165 |
+
}
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"at": 384,
|
| 169 |
+
"tensormap": {
|
| 170 |
+
"param": 3,
|
| 171 |
+
"dtype": "bf16",
|
| 172 |
+
"dims": [
|
| 173 |
+
256,
|
| 174 |
+
64,
|
| 175 |
+
4,
|
| 176 |
+
0
|
| 177 |
+
],
|
| 178 |
+
"strides": [
|
| 179 |
+
4096,
|
| 180 |
+
1024,
|
| 181 |
+
524288
|
| 182 |
+
],
|
| 183 |
+
"box": [
|
| 184 |
+
64,
|
| 185 |
+
64,
|
| 186 |
+
1,
|
| 187 |
+
1
|
| 188 |
+
],
|
| 189 |
+
"swizzle": 128,
|
| 190 |
+
"l2_promotion": 128
|
| 191 |
+
}
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
"at": 512,
|
| 195 |
+
"tensormap": {
|
| 196 |
+
"param": 0,
|
| 197 |
+
"dtype": "bf16",
|
| 198 |
+
"dims": [
|
| 199 |
+
256,
|
| 200 |
+
64,
|
| 201 |
+
4,
|
| 202 |
+
6,
|
| 203 |
+
1
|
| 204 |
+
],
|
| 205 |
+
"strides": [
|
| 206 |
+
12288,
|
| 207 |
+
512,
|
| 208 |
+
2048,
|
| 209 |
+
16
|
| 210 |
+
],
|
| 211 |
+
"box": [
|
| 212 |
+
64,
|
| 213 |
+
128,
|
| 214 |
+
1,
|
| 215 |
+
1,
|
| 216 |
+
1
|
| 217 |
+
],
|
| 218 |
+
"swizzle": 128,
|
| 219 |
+
"l2_promotion": 128
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"at": 912,
|
| 224 |
+
"param": 0
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
"at": 1000,
|
| 228 |
+
"param": 4
|
| 229 |
+
},
|
| 230 |
+
{
|
| 231 |
+
"at": 1080,
|
| 232 |
+
"param": 5
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"at": 1116,
|
| 236 |
+
"param": 7
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"at": 1244,
|
| 240 |
+
"param": 8
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"at": 936,
|
| 244 |
+
"param": 6
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"at": 1144,
|
| 248 |
+
"param": 8
|
| 249 |
+
},
|
| 250 |
+
{
|
| 251 |
+
"at": 1152,
|
| 252 |
+
"expr": {
|
| 253 |
+
"ceil_div": [
|
| 254 |
+
"tokens",
|
| 255 |
+
128
|
| 256 |
+
]
|
| 257 |
+
}
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"at": 1112,
|
| 261 |
+
"i32": 2147483647
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"at": 1148,
|
| 265 |
+
"i32": 704
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"at": 1156,
|
| 269 |
+
"i32": 1
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"at": 1160,
|
| 273 |
+
"i32": 11
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"at": 1164,
|
| 277 |
+
"i32": 4
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"at": 1168,
|
| 281 |
+
"i32": 24
|
| 282 |
+
},
|
| 283 |
+
{
|
| 284 |
+
"at": 1172,
|
| 285 |
+
"i32": 6
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"at": 1176,
|
| 289 |
+
"i32": 6
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"at": 1180,
|
| 293 |
+
"i32": -1431655765
|
| 294 |
+
},
|
| 295 |
+
{
|
| 296 |
+
"at": 1188,
|
| 297 |
+
"i32": 2
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"at": 1192,
|
| 301 |
+
"i32": 6144
|
| 302 |
+
},
|
| 303 |
+
{
|
| 304 |
+
"at": 1200,
|
| 305 |
+
"i32": 44
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"at": 1204,
|
| 309 |
+
"i32": 128
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"at": 1208,
|
| 313 |
+
"i32": 6
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"at": 1212,
|
| 317 |
+
"i32": 1
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"at": 1216,
|
| 321 |
+
"i32": 1065353216
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"at": 1220,
|
| 325 |
+
"i32": 1035512379
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"at": 1224,
|
| 329 |
+
"i32": 1065353216
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"at": 1228,
|
| 333 |
+
"i32": -1082130432
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"at": 1252,
|
| 337 |
+
"i32": 256
|
| 338 |
+
}
|
| 339 |
+
]
|
| 340 |
+
}
|
| 341 |
+
}
|
| 342 |
+
]
|
| 343 |
+
}
|
| 344 |
+
]
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
},
|
| 348 |
+
"programs": {
|
| 349 |
+
"verify": {
|
| 350 |
+
"batch": {
|
| 351 |
+
"groups": 2,
|
| 352 |
+
"rows": 8
|
| 353 |
+
},
|
| 354 |
+
"calls": [
|
| 355 |
+
{
|
| 356 |
+
"label": "attention",
|
| 357 |
+
"op": "verify",
|
| 358 |
+
"args": [
|
| 359 |
+
{
|
| 360 |
+
"buf": "out"
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"buf": "q"
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"buf": "kv",
|
| 367 |
+
"offset": 262144
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"buf": "kv",
|
| 371 |
+
"offset": 262656
|
| 372 |
+
},
|
| 373 |
+
{
|
| 374 |
+
"buf": "table"
|
| 375 |
+
},
|
| 376 |
+
{
|
| 377 |
+
"buf": "seq"
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"buf": "cuq"
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"var": "seqs"
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"var": "tokens"
|
| 387 |
+
}
|
| 388 |
+
]
|
| 389 |
+
}
|
| 390 |
+
]
|
| 391 |
+
}
|
| 392 |
+
}
|
| 393 |
+
}
|
validation/json-examples.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"example": "decode",
|
| 4 |
+
"batch": 2,
|
| 5 |
+
"query_tokens": 1,
|
| 6 |
+
"passed": true,
|
| 7 |
+
"bit_exact": false,
|
| 8 |
+
"relative_l2": 0.0019561010412871838,
|
| 9 |
+
"max_abs": 0.0009765625
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"example": "prefill",
|
| 13 |
+
"batch": 2,
|
| 14 |
+
"query_tokens": 129,
|
| 15 |
+
"passed": true,
|
| 16 |
+
"bit_exact": true,
|
| 17 |
+
"relative_l2": 0.0,
|
| 18 |
+
"max_abs": 0.0
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"example": "verify",
|
| 22 |
+
"batch": 2,
|
| 23 |
+
"query_tokens": 8,
|
| 24 |
+
"passed": true,
|
| 25 |
+
"bit_exact": true,
|
| 26 |
+
"relative_l2": 0.0,
|
| 27 |
+
"max_abs": 0.0
|
| 28 |
+
}
|
| 29 |
+
]
|