tilus.Script.global_view¶
- Script.global_view(ptr, *, dtype, shape, strides=None, layout=None)[source]¶
Create a global tensor view.
There are three ways to specify the layout:
layout: If provided, it overrides the shape and strides parameters.
shape: If provided, it defines the shape of the tensor and assume a compact row-major strides.
shape and strides: If provided, they define the shape and strides of the tensor.
- Parameters:
ptr (Expr) – The pointer to the global memory, which should be a pointer expression to the first element of the tensor.
dtype (DataType) – The data type of the tensor elements.
shape (Sequence[Expr | int]) – The shape of the tensor.
strides (Sequence[Expr | int], optional) – The strides of the tensor. If not provided, it is assumed to be compact row-major layout.
layout (GlobalLayout, optional) – The layout of the tensor. If provided, it overrides the shape and strides parameters.
- Returns:
ret – The global tensor view created.
- Return type: