vllm.models.inkling2.nvidia.ops.attention_sm90
¶
Inkling2 relative-bias paged attention for Hopper (Triton).
Stands in for tml_fa4 (prefill) and the tcgen05 decode/verify kernel of
ops/attention.py, reading the same sheared relative logits of
attention_prologue: column c of token t holds key
c + cdiv(past + tile_end, 128) * 128 - (E + 256), where tile_end ends
the token's 128-row query tile (see qr_clip_rel_tokens).
A program owns BLOCK_M rows (tokens x GQA group) of one request and KV
head, and one KV split: split s of S takes key blocks s, s + S, ...
of the rows' visible range, so a split count that depends only on the batch
holds for every replay of a CUDA graph.
Functions:
-
rel_attention–Launch
_rel_attention_kernelover the requests ofcu_seqlens_q.
rel_attention(q, key_cache, value_cache, out, lse, rel_logits, gate=None, sinks=None, *, block_table, cache_seqlens, cu_seqlens_q, max_query_len, softmax_scale, window, num_splits, mode)
¶
Launch _rel_attention_kernel over the requests of cu_seqlens_q.
rel_logits (sheared, (T + 128, H, extent + 256)) is None for the
DSpark draft: plain block attention with all queries of a request at
its last position. window (keys up to a query's position, inclusive) is
0 for full layers. mode selects the output: MODE_OUT_LSE writes the
fp32 out (T, H, D) and natural-log lse (H, T); MODE_GATED
the bf16 (T, H * D) out (gated by gate and sinks unless
drafting; a single split); MODE_PARTIAL the fp32 out
(S, T, H, D) and log2 lse (S, T, H) partials.
Source code in vllm/models/inkling2/nvidia/ops/attention_sm90.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |