flashinfer.fused_moe.TrtllmGenRoutingResult

class flashinfer.fused_moe.TrtllmGenRoutingResult(topk_ids: Tensor, topk_weights: Tensor, total_num_padded_tokens: Tensor, expanded_idx_to_permuted_idx: Tensor, permuted_idx_to_token_idx: Tensor, cta_idx_xy_to_batch_idx: Tensor, cta_idx_xy_to_mn_limit: Tensor, num_non_exiting_ctas: Tensor)

Outputs of the trtllm-gen MoE routing stage.

topk_ids/topk_weights are the per-token expert selection. The remaining fields are the permutation/bookkeeping tensors the fused MoE kernels consume; entries beyond the actual padded count (see total_num_padded_tokens) are undefined.

In from-logits mode the routing kernels never emit expert ids directly — expert identity lives in the permuted layout. topk_ids is therefore reconstructed on the torch side: permuted slot p belongs to CTA tile p // tile_tokens_dim, and cta_idx_xy_to_batch_idx maps each CTA tile to its expert.

__init__()

Methods

__init__()

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Attributes

cta_idx_xy_to_batch_idx

Alias for field number 5

cta_idx_xy_to_mn_limit

Alias for field number 6

expanded_idx_to_permuted_idx

Alias for field number 3

num_non_exiting_ctas

Alias for field number 7

permuted_idx_to_token_idx

Alias for field number 4

topk_ids

Alias for field number 0

topk_weights

Alias for field number 1

total_num_padded_tokens

Alias for field number 2