For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
fused_silu_kernel
def fused_silu_kernel[output_dtype: DType, input_dtype: DType, output_layout: TensorLayout, input_layout: TensorLayout, row_offsets_layout: TensorLayout, num_threads: Int, num_sms: Int](output_tensor: TileTensor[output_dtype, output_layout, MutUntrackedOrigin], input_tensor: TileTensor[input_dtype, input_layout, ImmUntrackedOrigin], row_offsets: TileTensor[DType.uint32, row_offsets_layout, ImmUntrackedOrigin])
This kernel performs the SILU operation for all the MLPs in the EP MoE module. We need to manually implement the kernel here is because after the EP dispatch phase, the actual number of received tokens is not known to the host. This kernel will read the row offsets to determine the actual number of received tokens in the input tensor.
Arguments: output_tensor: The output tensor to store the result. input_tensor: The input tensor to perform the SILU operation. row_offsets: The row offsets to determine the actual number of received tokens.
Parameters:
- βoutput_dtype (
DType): Element type of theoutput_tensor(e.g.DType.bfloat16). - βinput_dtype (
DType): Element type of theinput_tensor; its accumulation type must be floating-point. - βoutput_layout (
TensorLayout): Layout of theoutput_tensorTileTensor. - βinput_layout (
TensorLayout): Layout of theinput_tensorTileTensor. - βrow_offsets_layout (
TensorLayout): Layout of the 1Drow_offsetsTileTensor. - βnum_threads (
Int): Number of threads per block; sets theMAX_THREADS_PER_BLOCKlaunch metadata. - βnum_sms (
Int): Number of streaming multiprocessors (SMs) used to scatter processing across thread blocks.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!