tilus.ir.GlobalTensor

class tilus.ir.GlobalTensor[source]

A tensor that resides in the global memory.

dtype

The data type of the tensor elements.

Type:

DataType

layout

The layout of the tensor, which defines how the tensor is stored in global memory.

Type:

GlobalLayout

__getitem__(indices)[source]

Access the global tensor with the given indices.

This method allows you to access elements of the global tensor using indices.

This method is intended to be used in Tilus Script only.

Parameters:

indices (tuple[Expr | int, ...] | Expr | int) – The indices to access the global tensor.

Returns:

ret – An expression representing the accessed element of the global tensor.

Return type:

Expr

property shape: tuple[Expr, ...]

Get the shape of the global tensor.

This property returns the shape of the tensor as a tuple of expressions.

Returns:

ret – The shape of the global tensor.

Return type:

tuple[Expr, …]

property size: Expr

Get the size of the global tensor.

This property returns the storage size of the tensor as an expression, in the unit of number of elements. If the global tensor is not compact, it may not be equal to the product of the shape dimensions.

Returns:

ret – The size of the global tensor.

Return type:

Expr