tvm_tirx.tirx.TileLayout#
- class tvm_tirx.tirx.TileLayout(spec)#
Bases:
LayoutMap logical indices to memory and ownership coordinates using strided factors.
shardholds the factors for distinct logical elements;replicaholds factors for copies of those elements.offsetgives an origin per axis. Usefrom_iters()to construct these fields directly.- Parameters:
spec (layout specification) – Compose
S[shape:stride]shard factors, optionalR[shape:stride]replica factors, and offsets with+. Integer strides use the memory axism;stride @ Axis.nameselects another axis. Omitted strides use contiguous row-major memory order.
Examples
from tvm_tirx.script import tirx as T layout = T.TileLayout(T.S[4, 8]) # Contiguous 4-by-8 tile. assert int(layout.apply(1, 2)["m"]) == 10
- property shard#
- static from_iters(shard=(), replica=(), offset=None)#
Construct a TileLayout from pre-built Iter objects.
- is_contiguous(analyzer=None)#
Whether memory-only tile strides are contiguous, regardless of origin.
Replicas and non-memory axes are rejected. An optional analyzer supplies existing constraints; symbolic proof is otherwise initialized lazily.
- Return type:
- group(shape)#
Group the current layout by the given shape.
- get_scope()#
Get the scope pair of the layout.
- Return type:
tuple[ThreadScope, ThreadScope] | None
- permute_dims(perm)#
Permute the dimensions of the layout.
- Parameters:
perm (list[int])
- Return type:
- permute_by_groups(seps, perm)#
Permute groups of shard iters defined by
seps.sepsfollows the convention ofgroup()’s second return value:seps[0] == 0and groupicovers shard indices[seps[i], seps[i + 1]). The number of groups islen(seps) - 1.- Parameters:
seps (list[int]) – Group boundary positions in the shard list.
perm (list[int]) – Permutation of
range(len(seps) - 1)selecting the new group order.
- Return type:
- property offset#
- property replica#