Tensor Tiling Library
 
Loading...
Searching...
No Matches
TTL_tiles.h File Reference

Go to the source code of this file.

Data Structures

struct  TTL_augmentation_t
 3D description of the augmented margins More...
 
struct  TTL_tile_t
 
struct  TTL_tiler_t
 TTL_tiler_t is the basic unit that describes how a tile is subdivided. More...
 

Typedefs

typedef unsigned char TTL_augmented_dim_t
 Augment an input tensor with logical padding.
 

Functions

static TTL_augmentation_t TTL_create_augmentation (const TTL_augmented_dim_t left, const TTL_augmented_dim_t right, const TTL_augmented_dim_t top, const TTL_augmented_dim_t bottom, const TTL_augmented_dim_t front, const TTL_augmented_dim_t back)
 Create a 3D Description of a Tile augmentation.
 
static TTL_augmentation_t TTL_create_augmentation (TTL_augmented_dim_t left, TTL_augmented_dim_t right, TTL_augmented_dim_t top, TTL_augmented_dim_t bottom)
 Create a 2D Description of a Tile augmentation.
 
static TTL_augmentation_t TTL_create_augmentation (TTL_augmented_dim_t left, TTL_augmented_dim_t right)
 Create a 1D Description of a Tile augmentation.
 
static int TTL_number_of_tiles (TTL_tiler_t tiler)
 Return the number of tiles that this tile can produce.
 
static int TTL_valid_tile_id (int tile_id, TTL_tiler_t tiler)
 Given a tile ID return true or false to indicate if the id is valid.
 
static int TTL_ceil_of_a_div_b (const int a, const int b)
 Return the ceil value of a/b i.e. ceil(a/b)
 
static TTL_tiler_t TTL_create_overlap_tiler (const TTL_shape_t tensor_shape, const TTL_shape_t tile_shape, const TTL_overlap_t overlap, const TTL_augmentation_t augmentation)
 Return a TTL_tiler_t based on a shape, a tile, and an overlap.
 
static TTL_tiler_t TTL_create_tiler (const TTL_shape_t shape, const TTL_shape_t tile)
 
static TTL_dim_t TTL_tiles_in_width (TTL_tiler_t t)
 
static TTL_dim_t TTL_tiles_in_height (TTL_tiler_t t)
 
static TTL_dim_t TTL_tiles_in_depth (TTL_tiler_t t)
 
static int TTL_tile_empty (TTL_tile_t tile)
 Check if the tile passed is empty.
 
static TTL_tile_t TTL_create_empty_tile ()
 Create an empty tile. Empty means it has all dimensions set to zero.
 
static TTL_tile_t TTL_create_tile (TTL_dim_t x, TTL_dim_t y, TTL_dim_t z, TTL_tiler_t tiler)
 Returns a tile at a position from a tiler and respective coordinates.
 
static TTL_tile_t TTL_get_tile (const int tile_id, const TTL_tiler_t tiler)
 Return the tile_id'th tile of a tile array in row-major order.
 
static TTL_tile_t TTL_get_tile_column_major (const int tile_id, const TTL_tiler_t tiler)
 Return the tile_id'th tile of a tile array in column-major order.
 

Typedef Documentation

◆ TTL_augmented_dim_t

typedef unsigned char TTL_augmented_dim_t

Augment an input tensor with logical padding.

When an input tensor is imported using a tiler the resulting tensors may have elements beyond the space of the original tensor. In terms of the origin tensor the subtensor may for example start at offset(-1, -1, -1) in this case the elements at (-1, -1, -1), (-1, 0, 0) etc. needed to be created from a process of augmentation.

Currently the only dynamic part of the augmentation is the size of the augmentation the augmented values are simply hardcode.

A TTL_augmented_dim_t is the number of elements to augment. A number of a "augmented" elements in the unit of elements

Definition at line 38 of file TTL_tiles.h.

Function Documentation

◆ TTL_ceil_of_a_div_b()

static int TTL_ceil_of_a_div_b ( const int a,
const int b )
inlinestatic

Return the ceil value of a/b i.e. ceil(a/b)

Implementation of ceil(a/b) without requiring a library or floating-point.

Internal TTL function not part of the API.

Parameters
aThe dividend to use in the calculation
bThe divisor to use in the calculation

Definition at line 190 of file TTL_tiles.h.

◆ TTL_create_augmentation() [1/3]

static TTL_augmentation_t TTL_create_augmentation ( const TTL_augmented_dim_t left,
const TTL_augmented_dim_t right,
const TTL_augmented_dim_t top,
const TTL_augmented_dim_t bottom,
const TTL_augmented_dim_t front,
const TTL_augmented_dim_t back )
inlinestatic

Create a 3D Description of a Tile augmentation.

See also
TTL_overlap_t for more information.
Parameters
left///< Left hand augmentation in elements
right///< Right hand augmentation in elements
top///< Top augmentation in elements
bottom///< Bottom augmentation in elements
front///< Front augmentation in elements
back///< Back augmentation in elements
Returns
A TTL_augmentation_t describing in 3D the overlap requested.

Definition at line 72 of file TTL_tiles.h.

◆ TTL_create_augmentation() [2/3]

static TTL_augmentation_t TTL_create_augmentation ( TTL_augmented_dim_t left,
TTL_augmented_dim_t right )
inlinestatic

Create a 1D Description of a Tile augmentation.

See also
TTL_overlap_t for more information.
Parameters
left///< Left hand augmentation in elements
right///< Right hand augmentation in elements

top, bottom, front and back default to 0

Returns
A TTL_augmentation_t describing in 3D the overlap requested.

Definition at line 112 of file TTL_tiles.h.

◆ TTL_create_augmentation() [3/3]

static TTL_augmentation_t TTL_create_augmentation ( TTL_augmented_dim_t left,
TTL_augmented_dim_t right,
TTL_augmented_dim_t top,
TTL_augmented_dim_t bottom )
inlinestatic

Create a 2D Description of a Tile augmentation.

See also
TTL_overlap_t for more information.
Parameters
left///< Left hand augmentation in elements
right///< Right hand augmentation in elements
top///< Top augmentation in elements
bottom///< Bottom augmentation in elements

front and back default to 0

Returns
A TTL_augmentation_t describing in 3D the overlap requested.

Definition at line 93 of file TTL_tiles.h.

◆ TTL_create_empty_tile()

static TTL_tile_t TTL_create_empty_tile ( )
inlinestatic

Create an empty tile. Empty means it has all dimensions set to zero.

Most operations on an empty tile should turn into no-ops and so an empty tile is the safest default state.

Definition at line 267 of file TTL_tiles.h.

◆ TTL_create_overlap_tiler()

static TTL_tiler_t TTL_create_overlap_tiler ( const TTL_shape_t tensor_shape,
const TTL_shape_t tile_shape,
const TTL_overlap_t overlap,
const TTL_augmentation_t augmentation )
inlinestatic

Return a TTL_tiler_t based on a shape, a tile, and an overlap.

Parameters
tensor_shapeThe shape to be tiled
tile_shapeThe description of the tile that the shape will be sub-divided to.
overlapThe overlap between tiles
augmentationThe augomentation to apply at the edges durring import.

Complete description of what not how here.

Returns
A tiler that can produce a tile for any given index.

Definition at line 206 of file TTL_tiles.h.

◆ TTL_create_tile()

static TTL_tile_t TTL_create_tile ( TTL_dim_t x,
TTL_dim_t y,
TTL_dim_t z,
TTL_tiler_t tiler )
inlinestatic

Returns a tile at a position from a tiler and respective coordinates.

Parameters
xThe x position of the tile being created
yThe y position of the tile being created
zThe z position of the tile being created
tilerThe tiler from which the tiler can be calculated.
Returns
The created TTL_tile_t type

Definition at line 282 of file TTL_tiles.h.

◆ TTL_create_tiler()

static TTL_tiler_t TTL_create_tiler ( const TTL_shape_t shape,
const TTL_shape_t tile )
inlinestatic

Definition at line 229 of file TTL_tiles.h.

◆ TTL_get_tile()

static TTL_tile_t TTL_get_tile ( const int tile_id,
const TTL_tiler_t tiler )
inlinestatic

Return the tile_id'th tile of a tile array in row-major order.

Return the tile_id'th tile, starting from tile_id=0, in row-major order. Returns an invalid tile if tile_id is not valid (not from [0, number_of_tiles))

Parameters
tile_idThe tile id to return - if out of bounds then an invalid tile is returned
tilerThe containing with the shape and tiling information
Returns
The tile that is represented by tile_id when interpreted in row-major order.

Definition at line 319 of file TTL_tiles.h.

◆ TTL_get_tile_column_major()

static TTL_tile_t TTL_get_tile_column_major ( const int tile_id,
const TTL_tiler_t tiler )
inlinestatic

Return the tile_id'th tile of a tile array in column-major order.

Return the tile_id'th tile, starting from tile_id=0, in column-major order. Returns an invalid tile if tile_id is not valid (not from [0, number_of_tiles))

Parameters
tile_idThe tile id to return - if out of bounds then an invalid tile is returned
tilerThe tiler containing the shape and tiling information
Returns
The tile that is represented by tile_id when interpreted in column-major order.

Definition at line 348 of file TTL_tiles.h.

◆ TTL_number_of_tiles()

static int TTL_number_of_tiles ( TTL_tiler_t tiler)
inlinestatic

Return the number of tiles that this tile can produce.

Parameters
tilerThe tiler in question.
Returns
int The number of tiles produced by the tiler.

Definition at line 161 of file TTL_tiles.h.

◆ TTL_tile_empty()

static int TTL_tile_empty ( TTL_tile_t tile)
inlinestatic

Check if the tile passed is empty.

Empty is defined as width of the shape being equal to 0.

Parameters
tileThe tile to check the emptiness of.
Returns
true if shape is empty
false if shape is not empty

Definition at line 257 of file TTL_tiles.h.

◆ TTL_tiles_in_depth()

static TTL_dim_t TTL_tiles_in_depth ( TTL_tiler_t t)
inlinestatic

Definition at line 243 of file TTL_tiles.h.

◆ TTL_tiles_in_height()

static TTL_dim_t TTL_tiles_in_height ( TTL_tiler_t t)
inlinestatic

Definition at line 239 of file TTL_tiles.h.

◆ TTL_tiles_in_width()

static TTL_dim_t TTL_tiles_in_width ( TTL_tiler_t t)
inlinestatic

Definition at line 235 of file TTL_tiles.h.

◆ TTL_valid_tile_id()

static int TTL_valid_tile_id ( int tile_id,
TTL_tiler_t tiler )
inlinestatic

Given a tile ID return true or false to indicate if the id is valid.

Parameters
tile_idThe ID to validate.
tilerThe tiler in question.
Returns
int The number of tiles produced by the tiler.

Definition at line 173 of file TTL_tiles.h.