Skip to main content
Log in

Mojo function

pack_filter

pack_filter(filter: NDBuffer[type, rank, origin, shape, strides, alignment=alignment, address_space=address_space, exclusive=exclusive], packed_filter: NDBuffer[type, rank, origin, shape, strides, alignment=alignment, address_space=address_space, exclusive=exclusive], num_groups: Int)

This packs the filter form RSCF to FRSCf. Use the default micro kernel size for dynamic shapes.

pack_filter[simd_size: Int, micro_kernel_f_size: Int](filter: NDBuffer[type, rank, origin, shape, strides, alignment=alignment, address_space=address_space, exclusive=exclusive], packed_filter: NDBuffer[type, rank, origin, shape, strides, alignment=alignment, address_space=address_space, exclusive=exclusive], num_groups: Int)

This packs the filter form RSCF to FRSCf.

F is first broken down to segements of size micro_kernel_f_size, then the remainder is further divided by simd_size. The last residual elements if any is padded with zero to fill simd_size.

Parameters:

  • simd_size (Int): Can differ from the simd size of the input type.
  • micro_kernel_f_size (Int): The size of the last dimension in FRSCf, which is equals the size of the micro kernel's F dimension.

Args:

  • filter (NDBuffer[type, rank, origin, shape, strides, alignment=alignment, address_space=address_space, exclusive=exclusive]): Filter in RSCF layout (if 2D).
  • packed_filter (NDBuffer[type, rank, origin, shape, strides, alignment=alignment, address_space=address_space, exclusive=exclusive]): Packed filter in FRSCf layout (if 2D). F - the index of continuous segments in micro kernel. R, S, C - original R, S, C. f - the index within a continuous segments.
  • num_groups (Int): The number of groups in the convolution.