IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo struct

Struct_ep_dispatch_async_mxfp4

struct Struct_ep_dispatch_async_mxfp4

Registers the ep.dispatch_async.mxfp4 graph op with the graph compiler.

Implemented traits

AnyType, Deinitable, Movable

Methods

execute

static def execute[input_dtype: DType, dispatch_dtype: DType, dispatch_scale_dtype: DType, hidden_size: Int, top_k: Int, n_experts: Int, max_token_per_rank: Int, n_gpus_per_node: Int, n_nodes: Int, //, target: StringSpan[ImmStaticOrigin], *, MX_FORMAT: StringSpan[ImmStaticOrigin] = StringSpan("auto")](atomic_counters: ManagedTensorSlice[IOSpec[_, _].MutableInput, static_spec=atomic_counters.static_spec], input_tokens: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input_tokens.static_spec], topk_ids: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=topk_ids.static_spec], send_ptrs: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=send_ptrs.static_spec], recv_ptrs: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=recv_ptrs.static_spec], recv_count_ptrs: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=recv_count_ptrs.static_spec], context: DeviceContext)

Execute the Expert Parallelism async dispatch kernel. Tokens are transferred in MXFP4 format with per-token even-mode scales packed alongside the FP4 quants in the send buffer.

Parameters:

  • input_dtype (DType): DType of the input tokens before dispatch (inferred).
  • dispatch_dtype (DType): DType used for the quantized token payload during dispatch (inferred).
  • dispatch_scale_dtype (DType): DType of the per-token even-mode scales accompanying the dispatched tokens (inferred).
  • hidden_size (Int): Size of the model's hidden dimension (inferred).
  • top_k (Int): Number of experts each token is routed to (inferred).
  • n_experts (Int): Total number of experts across all GPUs (inferred).
  • max_token_per_rank (Int): Maximum number of tokens per GPU (inferred).
  • n_gpus_per_node (Int): Number of GPUs per node (inferred).
  • n_nodes (Int): Number of physical nodes (inferred).
  • target (StringSpan[ImmStaticOrigin]): Compile-time device target.
  • MX_FORMAT (StringSpan[ImmStaticOrigin]): Name of the MX element format, or auto to take it from the dtype. See MXFormat.from_name. Names the MX encoding of the wire payload. It cannot be inferred from dispatch_dtype: MXFP4 and MXFP6 both travel as DType.uint8 and differ only in bits per element. The default auto falls back to FP4 for a uint8 payload and FP8 E4M3 otherwise.

Args: