|
def | __init__ (self) |
|
TensorAccessSequence | simple_tiler (cls, Sequence[int] tensor_dims, Sequence[int]|None tile_dims=None, bool tile_col_major=False, bool iter_col_major=False, int pattern_repeat=1) |
|
TensorAccessSequence | group_tiler (cls, Sequence[int] tensor_dims, Sequence[int] tile_dims, Sequence[int]|None tile_group_dims=None, bool tile_col_major=False, bool tile_group_col_major=False, bool iter_col_major=False, int pattern_repeat=1, bool allow_partial=False) |
|
TensorAccessSequence | step_tiler (cls, Sequence[int] tensor_dims, Sequence[int] tile_dims, Sequence[int] tile_group_repeats, Sequence[int]|None tile_group_steps=None, bool tile_col_major=False, bool tile_group_col_major=False, bool iter_col_major=False, bool allow_partial=False, int pattern_repeat=1) |
|
|
Sequence[int] | __get_num_steps (cls, Sequence[int] tensor_dims, Sequence[int] tile_dims, Sequence[int] step_dims, Sequence[int] repeat_dims) |
|
Sequence[int] | __tile_offset_by_step_num (cls, int step_num, Sequence[int] tile_group_steps, Sequence[int] tile_group_repeats, Sequence[int] num_steps, bool iter_col_major) |
|
tuple[Sequence[int], Sequence[int]] | __sizes_strides_for_step_tile_group (cls, Sequence[int] tensor_dims, Sequence[int] tile_dims, Sequence[int] tile_group_steps, Sequence[int] tile_group_repeats, Sequence[int] tile_offsets, bool tile_col_major, bool tile_group_col_major, int pattern_repeat) |
|
This is a generator (similar to factory pattern) class which produces TensorAccessSequences
for common 2-dimensional tiling patterns.
TensorAccessSequence taplib.tensortiler2d.TensorTiler2D.group_tiler |
( |
|
cls, |
|
|
Sequence[int] |
tensor_dims, |
|
|
Sequence[int] |
tile_dims, |
|
|
Sequence[int] | None |
tile_group_dims = None , |
|
|
bool |
tile_col_major = False , |
|
|
bool |
tile_group_col_major = False , |
|
|
bool |
iter_col_major = False , |
|
|
int |
pattern_repeat = 1 , |
|
|
bool |
allow_partial = False |
|
) |
| |
The group_tiler is a special case of the step_tiler. The group_tiler produces a TensorAccessSequence
with a group of tiles per TensorAccesspattern in the sequence.
Args:
tensor_dims (Sequence[int]): The dimensions of the tensor to tile.
tile_dims (Sequence[int]): The dimension of the tile (a contiguous group of elements)
tile_group_dims (Sequence[int] | None, optional): Dimensions of the grouping of tiles, specified by number of tiles (not elements).
If None, assumed to be (1, 1). Defaults to None.
tile_col_major (bool, optional): Iterate column major within each tile. Defaults to False.
tile_group_col_major (bool, optional): Iterate column major between tiles in a group within a TensorAccessSequence. Defaults to False.
iter_col_major (bool, optional): Iterate column major over tiles within the TensorAccessSequence. Defaults to False.
pattern_repeat (int, optional): Apply a pattern n times within a single TensorAccessPattern. Defaults to 1.
allow_partial (bool, optional): While a tensor must decompose into tiles easily, a tensor may not decompose into tile groups evenly.
If True, uneven groups are allowed. If false, an exception will be thrown. Defaults to False.
Returns:
TensorAccessSequence: A TensorAccessSequence with one tile grouping per TensorAccessPattern
TensorAccessSequence taplib.tensortiler2d.TensorTiler2D.step_tiler |
( |
|
cls, |
|
|
Sequence[int] |
tensor_dims, |
|
|
Sequence[int] |
tile_dims, |
|
|
Sequence[int] |
tile_group_repeats, |
|
|
Sequence[int] | None |
tile_group_steps = None , |
|
|
bool |
tile_col_major = False , |
|
|
bool |
tile_group_col_major = False , |
|
|
bool |
iter_col_major = False , |
|
|
bool |
allow_partial = False , |
|
|
int |
pattern_repeat = 1 |
|
) |
| |
Args:
tensor_dims (Sequence[int]): The dimensions of the tensor to tile.
tile_dims (Sequence[int]): The dimension of the tile (a contiguous group of elements)
tile_group_repeats (Sequence[int]): Number of times a tile appears in each dimension in each TensorAccessPattern.
tile_group_steps (Sequence[int] | None, optional): Space between each tile repeat in each dimension, given in units of tile size. Defaults to None.
tile_col_major (bool, optional): Iterate column major within each tile. Defaults to False.
tile_group_col_major (bool, optional): Iterate column major between tiles in a group within a TensorAccessSequence. Defaults to False.
iter_col_major (bool, optional): Iterate column major over tiles within the TensorAccessSequence. Defaults to False.
allow_partial (bool, optional): _description_. Defaults to False.
pattern_repeat (int, optional): _description_. Defaults to 1.
Raises:
ValueError: The parameters are validated
ValueError: Some transformations are not expressible in only 4 dimensions of sizes/strides
ValueError: If allow_partial is False, an error will be thrown if partial TensorAccessPatterns are needed to fully tile the tensor.
Returns:
TensorAccessSequence: A TensorAccessSequence with one tile grouping per TensorAccessPattern,
where the tile grouping may or may not be contiguous.