tilelang.layout.cuteΒΆ

CuTe layout IR objects and layout-algebra Python API, in TileLang.

AttributesΒΆ

ClassesΒΆ

FunctionsΒΆ

to_python(t)

Unpack an IntTuple into Python: a branch becomes a nested tuple, and each leaf becomes a plain int (static), a PrimExpr (dynamic), or a ScaledBasis (basis stride).

from_python(value)

Convert a Python value to an FFI IntTuple (the inverse of to_python()): a nested tuple/list becomes an IntTupleTuple branch; an int becomes IntTupleConst; a PrimExpr becomes IntTuplePrimExpr; a ScaledBasis becomes IntTupleScaledBasis; an already-built IntTuple passes through.

E(mode)

product(shape)

flatten_to_tuple(value)

rank(layout)

flatten(layout)

size(layout)

coalesce(layout[, max_extent])

right_inverse(layout)

composition(lhs, rhs)

make_layout(shape[, stride])

make_column_major_layout(shape)

make_row_major_layout(shape)

make_identity_layout(shape)

Module ContentsΒΆ

tilelang.layout.cute.PyIntTupleΒΆ
tilelang.layout.cute.IntTupleLikeΒΆ
tilelang.layout.cute.ModeLikeΒΆ
tilelang.layout.cute.to_python(t)ΒΆ

Unpack an IntTuple into Python: a branch becomes a nested tuple, and each leaf becomes a plain int (static), a PrimExpr (dynamic), or a ScaledBasis (basis stride).

Parameters:

t (IntTuple)

Return type:

PyIntTuple

tilelang.layout.cute.from_python(value)ΒΆ

Convert a Python value to an FFI IntTuple (the inverse of to_python()): a nested tuple/list becomes an IntTupleTuple branch; an int becomes IntTupleConst; a PrimExpr becomes IntTuplePrimExpr; a ScaledBasis becomes IntTupleScaledBasis; an already-built IntTuple passes through.

Parameters:

value (IntTupleLike)

Return type:

IntTuple

class tilelang.layout.cute.SwizzleΒΆ

Bases: tvm.ir.base.Node, tvm.runtime.Scriptable

b_bits: intΒΆ
m_base: intΒΆ
s_shift: intΒΆ
property is_swizzled: boolΒΆ
Return type:

bool

recast(old_bits, new_bits)ΒΆ
Parameters:
  • old_bits (int)

  • new_bits (int)

Return type:

Swizzle

class tilelang.layout.cute.IntTupleΒΆ

Bases: tvm.ir.base.Node, tvm.runtime.Scriptable

__add__(other)ΒΆ
Parameters:

other (IntTupleLike)

Return type:

IntTuple

__radd__(other)ΒΆ
Parameters:

other (IntTupleLike)

Return type:

IntTuple

__mul__(other)ΒΆ
Parameters:

other (IntTupleLike)

Return type:

IntTuple

__rmul__(other)ΒΆ
Parameters:

other (IntTupleLike)

Return type:

IntTuple

class tilelang.layout.cute.IntTupleConstΒΆ

Bases: IntTuple

value: intΒΆ
class tilelang.layout.cute.IntTuplePrimExprΒΆ

Bases: IntTuple

value: objectΒΆ
class tilelang.layout.cute.IntTupleScaledBasisΒΆ

Bases: IntTuple

value: IntTupleΒΆ
basis: listΒΆ
class tilelang.layout.cute.IntTupleTupleΒΆ

Bases: IntTuple

fields: listΒΆ
class tilelang.layout.cute.ScaledBasis(value, mode)ΒΆ

A ScaledBasis wrapper.

Parameters:
  • value (PyIntTuple)

  • mode (ModeLike)

property value: PyIntTupleΒΆ
Return type:

PyIntTuple

property mode: tupleΒΆ
Return type:

tuple

__repr__()ΒΆ
Return type:

str

tilelang.layout.cute.E(mode)ΒΆ
Parameters:

mode (ModeLike)

Return type:

ScaledBasis

tilelang.layout.cute.product(shape)ΒΆ
Parameters:

shape (IntTupleLike)

Return type:

PyIntTuple

tilelang.layout.cute.flatten_to_tuple(value)ΒΆ
Parameters:

value (IntTupleLike)

Return type:

tuple

class tilelang.layout.cute.LayoutΒΆ

Bases: tvm.ir.base.Node, tvm.runtime.Scriptable

property shapeΒΆ
property strideΒΆ
__getitem__(idx)ΒΆ
Parameters:

idx (int)

Return type:

Layout

__call__(coord)ΒΆ
Parameters:

coord (IntTupleLike)

static from_tilelang(layout)ΒΆ
Return type:

Layout | None

tilelang.layout.cute.rank(layout)ΒΆ
Parameters:

layout (Layout)

Return type:

int

tilelang.layout.cute.flatten(layout)ΒΆ
Parameters:

layout (Layout)

Return type:

Layout

tilelang.layout.cute.size(layout)ΒΆ
Parameters:

layout (Layout | ComposedLayout)

Return type:

PyIntTuple

tilelang.layout.cute.coalesce(layout, max_extent=None)ΒΆ
Parameters:
  • layout (Layout)

  • max_extent (int | None)

Return type:

Layout

tilelang.layout.cute.right_inverse(layout)ΒΆ
Parameters:

layout (Layout)

Return type:

Layout

tilelang.layout.cute.composition(lhs, rhs)ΒΆ
Parameters:
Return type:

Layout

tilelang.layout.cute.make_layout(shape, stride=None)ΒΆ
Parameters:

shape (PyIntTuple)

Return type:

Layout

tilelang.layout.cute.make_column_major_layout(shape)ΒΆ
Parameters:

shape (PyIntTuple)

Return type:

Layout

tilelang.layout.cute.make_row_major_layout(shape)ΒΆ
Parameters:

shape (PyIntTuple)

Return type:

Layout

tilelang.layout.cute.make_identity_layout(shape)ΒΆ
Parameters:

shape (PyIntTuple)

Return type:

Layout

class tilelang.layout.cute.ComposedLayoutΒΆ

Bases: tvm.ir.base.Node, tvm.runtime.Scriptable

swizzle: SwizzleΒΆ
offset: intΒΆ
layout: LayoutΒΆ
recast(old_bits, new_bits)ΒΆ
Parameters:
  • old_bits (int)

  • new_bits (int)

Return type:

ComposedLayout

static from_tilelang(layout, buffer=None)ΒΆ
Parameters:

buffer (tilelang._typing.BufferLikeType)

Return type:

ComposedLayout | None