vllm.models.inkling2.nvidia.ops.trtllm_bmm
¶
TRT-LLM-gen batched expert GEMMs (FlashInfer cubins) for the Inkling2 MoE.
The GEMMs read expert-sorted activation rows whose expert segments are padded
to the token tile, with block scales in the R8c4 (tile < 128) or R128c4 layout
(block_scales), and row-shuffled expert weights. Outputs are bf16; NVFP4
outputs are scaled by an fp32 factor per row.
Classes:
-
ExpertPlan–Token tile, launched tiles (an upper bound) and the kernel of each
Functions:
-
bmm–bf16
[plan.rows, N]expert GEMM of the tile-paddedactrows. -
configs–Kernel name -> (config index, B scale layout) of the (format, token
-
expert_plan–Plan for
tokensrouted totopkof all experts,num_experts -
load_kernels–Loads the kernels of every batch size's plan by running them on no
-
operand–torch.empty((rows, *shape)), allocated with enough rows to span
ExpertPlan
dataclass
¶
Token tile, launched tiles (an upper bound) and the kernel of each projection for a batch.
Source code in vllm/models/inkling2/nvidia/ops/trtllm_bmm.py
bmm(act, act_scale, row_scale, weight, weight_scale, ones, tiles, plan, projection)
¶
bf16 [plan.rows, N] expert GEMM of the tile-padded act rows.
tiles holds the expert and row limit of each of the plan.max_ctas
tiles, then the number of tiles and of padded rows. ones (one per
expert) is the GEMM's output scale.
Source code in vllm/models/inkling2/nvidia/ops/trtllm_bmm.py
configs(nvfp4, tile_n)
cached
¶
Kernel name -> (config index, B scale layout) of the (format, token tile) GEMMs.
Source code in vllm/models/inkling2/nvidia/ops/trtllm_bmm.py
expert_plan(tokens, topk, num_experts, nvfp4, shapes, tile=None)
cached
¶
Plan for tokens routed to topk of all experts, num_experts
of them local, with (N, K) weight shapes of the two projections.
Source code in vllm/models/inkling2/nvidia/ops/trtllm_bmm.py
load_kernels(weights, weight_scales, topk)
¶
Loads the kernels of every batch size's plan by running them on no tiles: loading is not allowed while a CUDA graph is captured.
Source code in vllm/models/inkling2/nvidia/ops/trtllm_bmm.py
operand(rows, *shape, dtype, device)
¶
torch.empty((rows, *shape)), allocated with enough rows to span
MIN_OPERAND_BYTES.