vllm.models.minimax_m3.amd.ops.nvfp4_sparse_decode.host
¶
Launch wrapper of the FlyDSL NVFP4 sparse decode.
Functions:
-
decode_splits–Splits of a row's blocks.
-
minimax_m3_nvfp4_sparse_decode_fly–Sparse decode attention over the NVFP4 K/V pages.
_query_xcd_count(device_index)
¶
The device's XCD count, or zero when HIP cannot report it.
Source code in vllm/models/minimax_m3/amd/ops/nvfp4_sparse_decode/host.py
_split_buffers(device)
cached
¶
Split partials and tickets; allocated in the warm-up, before capture.
Source code in vllm/models/minimax_m3/amd/ops/nvfp4_sparse_decode/host.py
_xcd_count(device_index)
cached
¶
8 on gfx950 (the topology the XCD grid was tuned on), else 0.
Source code in vllm/models/minimax_m3/amd/ops/nvfp4_sparse_decode/host.py
_xcd_splits(num_reqs, xcds, topk, decode_query_len, num_kv_heads)
¶
Splits for the XCD-aware grid with up to three requests per XCD, or None.
A request's rows and splits all run on one XCD (32 CUs), so the cost model
of decode_splits, which spreads the grid over every CU, mispredicts: at
5 requests it picks 6 splits for 15.7 us where 4 splits take 11.9 us.
Measured on MI355X (top-k 16, 8 rows a request, 30K-400K contexts, 1-24
requests; the kernel time does not depend on the context): 4 splits is
best up to 8 requests (11.4-12.4 us, one request per XCD) and for 17-24
requests (21 us), 2 splits for 9-16 requests (15.3-16 us). Wider grids use
the cost model. A request's KV heads also share its XCD, so with 2 or 4 KV
heads per rank (TP2, TP1) the table over-splits and the cost model is kept.
Source code in vllm/models/minimax_m3/amd/ops/nvfp4_sparse_decode/host.py
decode_splits(num_rows, num_blocks, cus)
¶
Splits of a row's blocks.
The kernel is VALU-bound, so the cost model is rounds of workgroups per CU times blocks per split plus about one block of fixed cost; the fewest splits among the minima, each split at least two blocks.
Source code in vllm/models/minimax_m3/amd/ops/nvfp4_sparse_decode/host.py
minimax_m3_nvfp4_sparse_decode_fly(q, kv_cache, topk_idx, block_table, seq_lens, sm_scale, output, k_scale=None, v_scale=None, decode_query_len=1, splits=None, xcd_count=None)
¶
Sparse decode attention over the NVFP4 K/V pages.
Row i is query row i % decode_query_len of request i // decode_query_len
and attends to the tokens of its topk_idx blocks up to its position.
Source code in vllm/models/minimax_m3/amd/ops/nvfp4_sparse_decode/host.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |