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
block_scales_interleave_fp4_kernel
def block_scales_interleave_fp4_kernel[scales_dtype: DType, input_scales_layout: Layout, output_scales_layout: Layout, *, SF_VECTOR_SIZE: Int = Int(16), num_max_threads: Int = Int(1024)](input_scales: LayoutTensor[scales_dtype, input_scales_layout, ImmutAnyOrigin], output_scales: LayoutTensor[scales_dtype, output_scales_layout, MutAnyOrigin])
GPU kernel that reinterleaves rank-2 scale factors into the 5D TCGEN layout.
Each thread reads one scale factor from the flat input and writes it into the interleaved output at the swizzled position required by the tensor-core scale-factor feed.
Parameters:
- βscales_dtype (
DType): Element type of the scale-factor tensors. - βinput_scales_layout (
Layout): Layout of the input scale-factor tensor. - βoutput_scales_layout (
Layout): Layout of the output scale-factor tensor. - βSF_VECTOR_SIZE (
Int): Number of elements covered by each block scale factor (defaults to 16). - βnum_max_threads (
Int): Maximum number of threads per block for the launch grid (defaults to 1024).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!