vllm.v1.attention.ops.ultraquant.triton_store
¶
Triton store kernel for the ultraquant KV cache format.
Per-token, per-head, per-group-of-32 the kernel computes:
s_raw = c * absmax(group) # c = 0.156 by default
s = 2^round(log2(s_raw)) # UE8M0 snap (power of 2)
code = quantize_to_fp4(group / s) # OCP E2M1, 4 bits/elt
and stores code as packed nibbles + s as a single UE8M0 byte per
group. The output layout matches format.py (272 B/slot for D=256).
K is Hadamard-rotated in-register; V is not. There is no per-token L2
norm. The UE8M0 snap makes s a power of two so scaled F8F6F4 MFMA
can consume it on the read side.
Functions:
-
ultraquant_store–Launch the ultraquant store kernel. Writes K/V into
kv_cache
_kv_cache_flat(kv_cache)
¶
1-D uint8 view of the raw KV allocation (handles padded layouts).
Source code in vllm/v1/attention/ops/ultraquant/triton_store.py
ultraquant_store(key, value, kv_cache, slot_mapping, *, PiT=None, constant_c=None)
¶
Launch the ultraquant store kernel. Writes K/V into kv_cache
in-place at the slots specified by slot_mapping.
Source code in vllm/v1/attention/ops/ultraquant/triton_store.py
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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |