tilus.ir.layout.global_strides

Contents

tilus.ir.layout.global_strides

tilus.ir.layout.global_strides(shape, strides)[source]

Create a global layout with specified strides.

This function creates a global layout with the given shape and strides. Given the axes and strides, we map the axes to sum(axes[i] * strides[i]) to compute the offset of the global tensor.

Parameters:
  • shape (Sequence[Expr | int]) – The shape of the global tensor. Each dimension can be an expression of grid-invariant expression, or a constant integer.

  • strides (Sequence[Expr | int]) – The strides of the global tensor. Each stride corresponds to the step size in each dimension when traversing the global tensor. It should have the same length as the shape. Each stride can be an expression of grid-invariant expression, or a constant integer.

Returns:

ret – A global layout with the specified shape and strides. The offset is computed as the sum of the product of each axis and its corresponding stride.

Return type:

GlobalLayout