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 module
conv_utils
Utilities for direct convolution kernels on CPU.
Provides convolution shape description, L2 tiling heuristics, micro-kernel shape selection, and work partitioning helpers used by the direct and im2col convolution implementations.
comptime valuesβ
elementwise_epilogue_typeβ
comptime elementwise_epilogue_type = def[rank: Int](coords: IndexList[rank], f_size: Int) capturing thin -> None
elementwise_simd_epilogue_typeβ
comptime elementwise_simd_epilogue_type = def[dtype: DType, rank: Int, width: SIMDLength, alignment: Int = Int(1)](IndexList[rank], SIMD[dtype, width]) capturing thin -> None
Structsβ
- β
ConvAlgorithm: Tags the convolution algorithm selected for a given operation. - β
ConvInfoStatic: Holds statically known convolution attributes (padding, stride, dilation, groups). - β
ConvPartition: Work range for a partition. - β
ConvShape: A shape struct describing the convolution dimensions.
Functionsβ
- β
align_down_residual: Returns the remainder after aligning down value to alignment. - β
append_shape: Append input shape by insertinglast2ndandlastat the end. - β
extend_shape: Extend input shape by insertingfirstandlastat both ends. - β
get_conv_num_partitions: Partition the workload in (batch, C, F, HOWO) dimensions. HOWO is the combination of HO and WO dimensions. The actual number of tasks are the product of return num_partitions. - β
get_conv_num_tasks: Returns the number of tasks to partition the convolution into. - β
get_conv_shape: Builds aConvShapefrom the output, input, and filter tile tensors. - β
get_conv_tile_shape: Compute the (c, f) tile shape in L2. - β
get_conv_tile_size: Returns the convolution L2 cache tile size in elements for the target. - β
get_direct_conv_micro_kernel_height: Returns the micro-kernel height for direct convolution on the target CPU. - β
get_direct_conv_micro_kernel_width: Returns the micro-kernel width for direct convolution on the target CPU. - β
get_micro_kernel_shape: Selects the(height, width)micro-kernel tile shape for the target. - β
get_partition: Computes theConvPartitionwork range for a given task id. - β
reorder_padding: Reorders padding entries into(lower, upper)pairs per dimension.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!