vllm.models.hy_v4_flash.nvidia.indexpool_ops
¶
Coarse IndexPool mathematics, independent of cache allocation.
Every decode step runs these per DSA layer, so each stage is a single Triton kernel instead of a chain of eager elementwise ops.
Functions:
-
pool_quantize_write–Gate-pool raw keys, RoPE, FWHT, FP8-quantize and write pool pages.
-
quantize_query–RoPE, FWHT and FP8-quantize indexer queries, padding heads with zeros.
-
select_expand_groups–Pick each row's top pool groups and expand them to sorted token indices.
_fwht32(x, BM)
¶
Hadamard butterflies with strides 1..16 inside each 32-wide row.
Source code in vllm/models/hy_v4_flash/nvidia/indexpool_ops.py
_pool_lanes(value_row, Ape, lanes, mask, R, BM)
¶
Softmax over the R group members, then the weighted value sum.
Each member row holds 128 values followed by 128 gate logits.
Source code in vllm/models/hy_v4_flash/nvidia/indexpool_ops.py
_rotate_fwht_quantize(a0, a1, even, odd, frequency, BM)
¶
RoPE the last 64 lanes, then FWHT and power-of-two FP8 quantize.
Inputs are fp32 holding BF16 values: a0/a1 are lanes 0..63 and
even/odd the interleaved rotary pairs. The butterflies run in the
same order as the reference radix-2 transform, so results are bitwise
identical to it.
Source code in vllm/models/hy_v4_flash/nvidia/indexpool_ops.py
pool_quantize_write(projection, ape, norm_weight, eps, positions, parameters, cache, table, owners, groups, active, mx_scales)
¶
Gate-pool raw keys, RoPE, FWHT, FP8-quantize and write pool pages.
Parameters:
-
(projection¶Tensor) –[slots, ratio, 256]FP32 value projections followed by gate projections. -
(ape¶Tensor) –[ratio, 128]intra-group position bias. -
(norm_weight¶Tensor) –[128]key RMSNorm weight. -
(eps¶float) –RMSNorm epsilon.
-
(positions¶Tensor) –[slots]or[3, slots]group positions. -
(parameters¶dict[str, Any]) –Layer RoPE parameters.
-
(cache¶Tensor) –[blocks, page, 132]UINT8 pool pages. -
(table¶Tensor) –[requests, blocks]block table. -
(owners¶Tensor) –[slots]request of each slot. -
(groups¶Tensor) –[slots]pool group of each slot. -
(active¶Tensor) –[slots]whether each slot is written. -
(mx_scales¶bool) –Store scales as four UE8M0 bytes instead of FP32.
Source code in vllm/models/hy_v4_flash/nvidia/indexpool_ops.py
quantize_query(query, head_weights, positions, parameters, padded_heads)
¶
RoPE, FWHT and FP8-quantize indexer queries, padding heads with zeros.
Parameters:
-
(query¶Tensor) –[tokens, heads, 128]BF16 with unit-stride heads. -
(head_weights¶Tensor) –[tokens, heads]per-head scoring weights. -
(positions¶Tensor) –[tokens]or[3, tokens]positions. -
(parameters¶dict[str, Any]) –Layer RoPE parameters.
-
(padded_heads¶int) –Head count the MQA logits kernel expects.
Returns:
-
Tensor–FP8 queries of shape
[tokens, padded_heads, 128]. -
Tensor–FP32 weights of shape
[tokens, padded_heads]with each head's quantization scale folded in.
Source code in vllm/models/hy_v4_flash/nvidia/indexpool_ops.py
select_expand_groups(logits, upper, budget, logical, active, ratio, out, topk)
¶
Pick each row's top pool groups and expand them to sorted token indices.
Parameters:
-
(logits¶Tensor) –[rows, width]FP32 group scores. -
(upper¶Tensor) –[rows]number of complete groups visible to each row. -
(budget¶int) –Maximum number of recalled groups.
-
(logical¶Tensor) –[rows]logical query positions (negative when padded). -
(active¶Tensor) –[rows]whether each row is a live query. -
(ratio¶int) –Tokens per group.
-
(out¶Tensor) –[rows, budget * ratio + ratio]INT32 destination. Live indices are packed in ascending order, followed by-1padding. -
(topk¶SparseIndexerTopk) –The sparse indexer top-k stage that selects the groups.