vllm.models.kimi_k3.nvidia.specialized_decode.cutedsl.moe.experts_runtime
¶
Persistent routed experts for B<=WIDE_ROWS (B>8: grouped units of <=8 tokens per expert; B>64: the wide grouped engine, always pregrouped, over its own wide workspace) over one shared core and model-owned workspace. The entry wait completes the predecessor (incl. workspace rearm/counters) before shared state is read; output rows keep the caller's top16 order.
Classes:
Functions:
-
compile_experts–Only code and geometry are cached; no owner tensors or descriptors.
knobs: -
compile_group–The pregrouped experts' unit-table kernel: (ids, workspace, batch);
early: -
compile_plan–Plan writer for callers without the routing kernel's copy role in front.
-
dynamic–Static B<=8: FC2 tile-pair jobs claimed from a grid-wide counter
-
early_group–Pregrouped batches whose unit-table kernel releases the experts at its entry.
-
pregrouped–B>8 experts read the unit table a one-CTA kernel builds after routing, beside
-
scratch–Model-owned expert buffers: the workspace and the grouped plan (MXFP8 x, written
-
static–Streamed B<=8 with TP8 FC2 pairs: the MMA warp walks the producer's static
-
stealing–B>8 experts balance the FC2(B) tail by claims.
-
streamed–B<=8 on the incremental producer: ~1-1.5% at B4-8, neutral at B1-2, which keep
PersistentExperts
¶
Methods:
-
group–Pregrouped batches prepared
early: the unit-table kernel (run it on the -
prepare–publish: (multicast, parity, rank) of the WaveMoeTail latent slot to -
run–ahead: the next weights' [PREFETCH_ROWS, 2] (address, bytes) table, for
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
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 | |
group(ids)
¶
Pregrouped batches prepared early: the unit-table kernel (run it on the
stream after routing; run then skips it).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
prepare(batch, buffers, out, publish=(), planned=False, twoshot=False, early=False, ahead=False, listed=False)
¶
publish: (multicast, parity, rank) of the WaveMoeTail latent slot to
publish (twoshot: the common.twoshot push box); planned: B>8 calls
find the plan written (by the routing kernel), else run writes it from x first;
early: the caller runs group (pregrouped batches) before run;
listed (wide): the routing kernel appended the routing lists
(buffers["lists"], passed to run as ids) and wrote the plan; no
unit-table kernel runs.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
run(x, ids, weights=None, ahead=None)
¶
ahead: the next weights' [PREFETCH_ROWS, 2] (address, bytes) table, for
batches prepared ahead.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
compile_experts(tp, experts, batch, grid, device, publish=False, *knobs)
cached
¶
Only code and geometry are cached; no owner tensors or descriptors. knobs:
(B<=8 stream, pregrouped, steal, listed, ahead, static, dynamic).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
compile_group(tp, experts, batch, grid, device, early=False)
cached
¶
The pregrouped experts' unit-table kernel: (ids, workspace, batch); early:
it releases the experts at entry.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
compile_plan(batch, device)
cached
¶
Plan writer for callers without the routing kernel's copy role in front.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
dynamic(batch)
¶
Static B<=8: FC2 tile-pair jobs claimed from a grid-wide counter
(ExpertsKernel.dynamic): CTA stream rates vary by a few us per call, so a
static FC2 slice leaves the slowest CTA as the kernel's tail.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
early_group(tp, batch)
¶
Pregrouped batches whose unit-table kernel releases the experts at its entry.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
pregrouped(tp, batch)
¶
B>8 experts read the unit table a one-CTA kernel builds after routing, beside the fused shared expert (hidden at B9-32; at B64 its ~2.3 us after routing outlast the shared expert).
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
scratch(tp, device, wide=False)
¶
Model-owned expert buffers: the workspace and the grouped plan (MXFP8 x, written
by the routing kernel or compile_plan). wide: the wide engines' own
workspace and plan (B > 64), never shared with the B <= 64 engines.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
static(batch)
¶
Streamed B<=8 with TP8 FC2 pairs: the MMA warp walks the producer's static
schedule (ExpertsKernel.consume_static). The grouped engines keep the slot
metadata: walking their FC1 stages gained 1-1.5% alone but lost 0.25% of the
TP8 R4 step.
Source code in vllm/models/kimi_k3/nvidia/specialized_decode/cutedsl/moe/experts_runtime.py
stealing(batch)
¶
streamed(batch)
¶
B<=8 on the incremental producer: ~1-1.5% at B4-8, neutral at B1-2, which keep the previous producer.