IRON  1.0
Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
taplib.tensortiler2d.TensorTiler2D Class Reference

Public Member Functions

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)
 

Private Member Functions

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)
 

Static Private Attributes

 _DTYPE = np.int32
 
int _NUM_DIMS = 2
 

Detailed Description

This is a generator (similar to factory pattern) class which produces TensorAccessSequences
for common 2-dimensional tiling patterns.

Constructor & Destructor Documentation

◆ __init__()

def taplib.tensortiler2d.TensorTiler2D.__init__ (   self)

Member Function Documentation

◆ __get_num_steps()

Sequence[int] taplib.tensortiler2d.TensorTiler2D.__get_num_steps (   cls,
Sequence[int]  tensor_dims,
Sequence[int]  tile_dims,
Sequence[int]  step_dims,
Sequence[int]  repeat_dims 
)
private

◆ __sizes_strides_for_step_tile_group()

tuple[Sequence[int], Sequence[int]] taplib.tensortiler2d.TensorTiler2D.__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 
)
private

◆ __tile_offset_by_step_num()

Sequence[int] taplib.tensortiler2d.TensorTiler2D.__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 
)
private

◆ group_tiler()

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

◆ simple_tiler()

TensorAccessSequence taplib.tensortiler2d.TensorTiler2D.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 
)
The simple_tiler is a special case of the group_tiler. The simple_tiler produces a TensorAccessSequence
with one TensorAccessPattern per tile.

Args:
    tensor_dims (Sequence[int]): The dimensions of the tensor to tile.
    tile_dims (Sequence[int] | None, optional): The dimension of the tile. If None, the tile_dims is set equal to the tensor_dims. Defaults to None.
    tile_col_major (bool, optional): Iterate column major within each tile. Defaults to False.
    iter_col_major (bool, optional): Iterate column major over tiles within the TensorAccessSequence. Defaults to False.
    pattern_repeat (int, optional): Access a tile n times per TensorAccessPattern. Defaults to 1.

Returns:
    TensorAccessSequence: A TensorAccessSequence with one TensorAccessPattern per tile

◆ step_tiler()

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.

Member Data Documentation

◆ _DTYPE

taplib.tensortiler2d.TensorTiler2D._DTYPE = np.int32
staticprivate

◆ _NUM_DIMS

int taplib.tensortiler2d.TensorTiler2D._NUM_DIMS = 2
staticprivate

The documentation for this class was generated from the following file: