vllm.models.muse_spark.nvidia.specialized_decode.runtime.decode
¶
The specialized decode executor over the stock Muse Spark backbone: one plan per captured decode graph, then every layer's providers in one loop.
One step of b rows (one request verifying 1 + 7 tokens):
embedding token ids -> embedded tokens: the stock embedding, eagerly before
forward on the Omni class, in the graph on the text class
per layer the first layer: the embedded tokens into the stream (fp32) and
its pre_qkv_proj_norm into the attention input, one kernel
input boundary (later layers): gather of the previous MoE's
unpooler blocks + the dual norm into the stream and this layer's
attention input
attention: QKV front -> attn2 -> o_proj partial (TP8: published
into the attention boundary's mailbox from the GEMM epilogue)
attention boundary: all-reduce + the dual norm into the stream
and the MoE input
MoE: router -> routing -> pooler -> routed experts -> tail ->
unpooler, published zero-copy into the next boundary's mailbox
(TP8: the NVFP4 layers' experts run expert TP, and their tail
is the TP tail instead of the EP tail)
final the last gather + dual norm into model.norm
Every provider is built here, in one order that is the same on every rank: the builds are collective (symmetric-memory rendezvous, warm-ups that all-reduce).
Classes:
-
DecodeLayer–The providers of one decoder layer.
-
Layout–The provider class of each block, for one TP size.
-
SpecializedDecode–Built once the weights are loaded and the aux layers set; owns every provider
Functions:
-
decode_metadata–The layer's metadata if this step is one request verifying all b = q tokens,
-
layer_metadata–The layer's attention metadata in this forward context, or None.
-
provider_requirements–The first failing requirement of the layout's providers, or None.
DecodeLayer
¶
Bases: NamedTuple
The providers of one decoder layer.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
Layout
¶
Bases: NamedTuple
The provider class of each block, for one TP size.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
SpecializedDecode
¶
Built once the weights are loaded and the aux layers set; owns every provider and the decode buffers. Reads the backbone, never modifies it.
Methods:
-
build–Every provider, in the same order on every rank (the builds are
-
captured–Logs each capture-time outcome once and returns
step. -
plan–This step's decode plan, or None to run the stock forward instead.
-
prepare_kv–Prepare every provider for the bound KV caches (the profiling cache, then
-
run–Normalized hidden states (and the aux streams) of a planned step.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
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 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
build(ctx, layout)
¶
Every provider, in the same order on every rank (the builds are collective).
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
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 | |
captured(b, fallback, step=None)
¶
Logs each capture-time outcome once and returns step.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
plan(positions, intermediate_tensors)
¶
This step's decode plan, or None to run the stock forward instead.
Steps that run the stock forward:
- pipeline-parallel stage inputs (intermediate_tensors);
- token counts other than BATCHES;
- steps outside a CUDA graph capture (profiling, warmup and the warmup run
before each capture), so every stock kernel runs before its capture;
- PIECEWISE steps, keyed by token count alone and so captured as stock;
- steps other than one request verifying q tokens (prefills, several
requests, partial drafts);
- decode metadata other than the TRT-LLM form attn2 reads;
- steps whose QKV front call the kernel does not take (positions or slot
mapping in another form).
attn2 serves every context length up to max_model_len and each layer's sliding window.
Every predicate reads host state, the same on all TP ranks: the providers' collectives need every rank to take the same path.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
prepare_kv()
¶
Prepare every provider for the bound KV caches (the profiling cache, then the real one).
run(step, input_ids, inputs_embeds)
¶
Normalized hidden states (and the aux streams) of a planned step.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
decode_metadata(layer, context, q, b)
¶
The layer's metadata if this step is one request verifying all b = q tokens, else None.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
layer_metadata(layer, context)
¶
The layer's attention metadata in this forward context, or None.
Source code in vllm/models/muse_spark/nvidia/specialized_decode/runtime/decode.py
provider_requirements(vllm_config)
¶
The first failing requirement of the layout's providers, or None.