jax.experimental.pallas.mosaic_gpu.find_swizzle

Contents

jax.experimental.pallas.mosaic_gpu.find_swizzle#

jax.experimental.pallas.mosaic_gpu.find_swizzle(minor_dim_bits, what='')[source]#

Returns the largest swizzle that can be applied to a memory region.

Swizzling is usually necessary when dealing with 2D data in SMEM, especially if the reference is used as an MMA operand. The returned swizzle is usually applied as plgpu transform:

transforms = (
    plgpu.TilingTransform((8, 8 * swizzle // elem_bits)),
    plgpu.SwizzleTransform(swizzle))
)
Parameters:
  • minor_dim_bits (int) – The number of bits in the minor (last) dimension of the memory region. Usually computed as dim_size * jnp.finfo(dtype).bits.

  • what (str) – A string describing the operand for which the swizzle is being computed. Improves the error message if specified.