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_fused_silu_mxfp4
struct Struct_ep_fused_silu_mxfp4
Registers the ep.fused_silu.mxfp4 graph op with the graph compiler.
Implemented traitsโ
Methodsโ
executeโ
static def execute[quant_dtype: DType, scales_dtype: DType, input_dtype: DType, target: StringSpan[ImmStaticOrigin], *, max_padded_M: Int, activation: StringSpan[ImmStaticOrigin] = StringSpan("silu"), swiglu_alpha: Float32 = 0, swiglu_limit: Float32 = 0, trace_name: StringSpan[ImmStaticOrigin] = StringSpan("ep.fused_silu.mxfp4")](output: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=output.static_spec], scales: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=scales.static_spec], input: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec], row_offsets: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=row_offsets.static_spec], context: DeviceContextBase)
Execute the Expert Parallelism fused SILU kernel with MX quantization.
Shared body for ep.fused_silu.mxfp4 and ep.fused_silu.mxfp8:
fused_silu_mx_kernel takes its element packing from quant_dtype.
trace_name only labels the op in traces; it is defaulted and no
caller sets it through MOGG's parameters dict, so the mxfp8
registration overrides it directly at the Mojo call site.
This function launches the shared fused_silu_mx_kernel to perform the SILU
operation for all the MLPs in the EP MoE module.
This kernel will read the row offsets to determine the actual number of received tokens in the input tensor, and then only perform the SILU operation on the received tokens. Once the SILU operation is performed, the output will be quantized to the MXFP4 or MXFP8 format.
The kernel writes the E8M0 scale directly into the grouped matmul's
per-expert fixed-stride scale_4d slot layout (slot stride
max_padded_M * K_SCALES; KS64 fusion), so the scales output tensor
has shape [n_local_experts * max_padded_M, K_SCALES].
The gated activation is built at compile time from the activation,
swiglu_alpha and swiglu_limit parameters.