Skip to main content
Log in

Mojo function

shuffle_idx

shuffle_idx[type: DType, simd_width: Int, //](val: SIMD[type, simd_width], offset: SIMD[uint32, 1]) -> SIMD[type, simd_width]

Copies a value from a source lane to other lanes in a warp.

Broadcasts a value from a source thread in a warp to all the participating threads without the use of shared memory

Parameters:

  • type (DType): The type of the simd value.
  • simd_width (Int): The width of the simd value.

Args:

  • val (SIMD[type, simd_width]): The value to be shuffled.
  • offset (SIMD[uint32, 1]): The offset warp lane ID.

Returns:

The value from the offset.

shuffle_idx[type: DType, simd_width: Int, //](mask: UInt, val: SIMD[type, simd_width], offset: SIMD[uint32, 1]) -> SIMD[type, simd_width]

Copies a value from a source lane to other lanes in a warp.

Broadcasts a value from a source thread in a warp to all the participating threads without the use of shared memory

Parameters:

  • type (DType): The type of the simd value.
  • simd_width (Int): The width of the simd value.

Args:

  • mask (UInt): The mask of the warp lanes.
  • val (SIMD[type, simd_width]): The value to be shuffled.
  • offset (SIMD[uint32, 1]): The source warp lane ID.

Returns:

The value from the offset.