vllm.models.minimax_m3.amd.mono.runner
¶
One decode step of 1..MAX_TOKENS tokens on the mono kernels.
Every sparse MoE layer is one launch of the fused layer kernel; it takes
(ar, res) -- the pair vLLM's input norm would receive (reduced MoE output,
residual) -- and leaves (ar, h_mid) for the next layer, alternating between
two buffers by layer parity. The embedding, the leading dense-FFN layers and the
final norm run the original modules. The K/V cache is read in vLLM's interleaved
page-16 layout under the fixed unit fp8 scale; the step's tables come from the
forward context.
Classes:
-
MonoDecodeRunner–Owns the per-layer weight views, scratch, peer buffers and compiled kernels.
-
StepTables–The per-step inputs every layer launch of a decode step shares.
Functions:
-
dense_prefix–Leading layers without an MoE FFN; every later layer must be sparse MoE.
-
token_rows–One (block table row, seq_len) per token of the step: a request of q query
MonoDecodeRunner
¶
Owns the per-layer weight views, scratch, peer buffers and compiled kernels.
Methods:
-
cache_ptrs–Addresses of the first MoE layer's KV cache and index cache.
-
forward–The final hidden states of one decode step (what the model returns).
-
run_sparse_layer–Sparse layer
i: (ars[i % 2][:n], res) -> (ars[(i + 1) % 2][:n], the -
stale–Whether vLLM re-bound the caches this runner viewed (profiling capture).
-
start–Embedding and the dense layers on the original modules; leaves the first
-
step_tables–The current step's tables for
ntokens, from the forward context.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 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 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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
_build(npes, heads, eps, route_scale, shared_weight, swiglu_limit, init_blocks, local_blocks)
¶
Compile the layer kernels and allocate scratch, peer buffers and the
per-step activation buffers; self.sparse and self.sm_scale are set.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
cache_ptrs(model, n_dense)
staticmethod
¶
Addresses of the first MoE layer's KV cache and index cache.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
forward(input_ids, positions, inputs_embeds=None)
¶
The final hidden states of one decode step (what the model returns).
Source code in vllm/models/minimax_m3/amd/mono/runner.py
run_sparse_layer(i, lw, tables, positions, res)
¶
Sparse layer i: (ars[i % 2][:n], res) -> (ars[(i + 1) % 2][:n], the
returned residual).
Source code in vllm/models/minimax_m3/amd/mono/runner.py
stale()
¶
Whether vLLM re-bound the caches this runner viewed (profiling capture).
start(input_ids, positions, inputs_embeds, aux_hidden_states=None)
¶
Embedding and the dense layers on the original modules; leaves the first
MoE layer's (ar, res) in ars[0][:n] and the returned residual (zeros
when layer 0 is already an MoE layer: (embeddings, 0)).
Source code in vllm/models/minimax_m3/amd/mono/runner.py
step_tables(n)
¶
The current step's tables for n tokens, from the forward context.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
StepTables
¶
Bases: NamedTuple
The per-step inputs every layer launch of a decode step shares.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
_fused_shared_weight()
¶
The fused shared expert's slot weight, from aiter's routing metadata.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
dense_prefix(layers)
¶
Leading layers without an MoE FFN; every later layer must be sparse MoE.
Source code in vllm/models/minimax_m3/amd/mono/runner.py
token_rows(block_table, seq_lens, q, n)
¶
One (block table row, seq_len) per token of the step: a request of q query
tokens becomes q rows, token j seeing seq_len - (q - 1 - j) keys.