Tilings: Decomposing Data

group aml_tiling

Tiling Data Structure High-Level API.

Tiling is a representation of the decomposition of data structures. It identifies ways a layout can be split into layouts of smaller size. As such, the main function of a tiling is to provide an index into subcomponents of a layout. Implementations focus on the ability to provide sublayouts of different sizes at the corners, and linearization of the index range.

Defines

AML_TILING_ORDER_FORTRAN

Tag specifying user storage of dimensions inside a layout. Layout order is the first bit in an integer bitmask.

See also

AML_TILING_ORDER() This tag will store dimensions in the order provided by the user, i.e elements of the last dimension will be contiguous in memory.

AML_TILING_ORDER_C

Tag specifying user storage of dimensions inside a layout. Layout order is the first bit in an integer bitmask.

See also

AML_TILING_ORDER() This tag will store dimensions in the reversed order provided by the user, i.e elements of the first dimension will be contiguous in memory. This storage is the actual storage used by the library inside the structure.

AML_TILING_ORDER_COLUMN_MAJOR

This is equivalent to AML_TILING_ORDER_FORTRAN.

AML_TILING_ORDER_ROW_MAJOR

This is equivalent to AML_TILING_ORDER_C.

AML_TILING_ORDER(x)

Get the order bit of an integer bitmask. The value can be further checked for equality with AML_TILING_ORDER_* values.

Parameters:
  • x[out] an integer with the first bit set to the order value.

Returns:

an integer containing only the bit order.

Functions

int aml_tiling_order(const struct aml_tiling *tiling)

Get the order in which dimensions of the tiling are supposed to be accessed by the user.

Parameters:

tiling[in] an initialized tiling.

Returns:

a bitmask with order bit set (or not set) on success, an AML error (<0) on failure. Output value can be further checked against order AML_TILING_ORDER flags by using the macro AML_TILING_ORDER() on the output value.

int aml_tiling_dims(const struct aml_tiling *tiling, size_t *dims)

Return the tiling dimensions in the user order.

Parameters:
  • tiling[in] an initialized tiling.

  • dims[out] a non-NULL array of dimensions to fill. It is supposed to be large enough to contain aml_tiling_ndims() elements.

Returns:

AML_SUCCESS on success, else an AML error code.

size_t aml_tiling_ndims(const struct aml_tiling *tiling)

Provide the number of dimensions in a tiling.

Parameters:

tiling[in] an initialized tiling structure.

Returns:

the number of dimensions in the tiling.

int aml_tiling_tile_dims(const struct aml_tiling *tiling, const size_t *coords, size_t *dims)

Get the dimensions of a specific tile in the tiling.

Parameters:
  • tiling[in] the tiling to inspect.

  • coords[in] the coordinate of the tile to lookup. If NULL, the first tile is used.

  • dims[out] the tile dimensions.

Returns:

AML_SUCCESS on success.

Returns:

the result of aml_tiling_index on error.

size_t aml_tiling_ntiles(const struct aml_tiling *tiling)

Provide the number of tiles in a tiling.

Parameters:

tiling[in] an initialized tiling structure.

Returns:

the number of tiles in the tiling.

struct aml_layout *aml_tiling_index(const struct aml_tiling *tiling, const size_t *coords)

Return the tile at specified coordinates in the tiling

Parameters:
  • tiling[in] an initialized tiling

  • coords[in] the coordinates for the tile

Returns:

the tile as a layout on success, NULL on error.

void *aml_tiling_rawptr(const struct aml_tiling *tiling, const size_t *coords)

Return a pointer to the first valid coordinate in the underlying tile.

Parameters:
  • tiling[in] an initialized tiling

  • coords[in] the coordinates for the tile

Returns:

a raw pointer to the start of the buffer for a tile, NULL on error.

struct aml_layout *aml_tiling_index_byiter(const struct aml_tiling *tiling, const_excit_t iterator)

Return the tile at the coordinates at the current position of the input iterator.

Parameters:
  • tiling[in] an initialized tiling

  • iterator[in] an initialized iterator

Returns:

the tile as a layout on success, NULL on error.

int aml_tiling_fprintf(FILE *stream, const char *prefix, const struct aml_tiling *tiling)

Print on the file handle the metadata associated with this tiling.

Parameters:
  • stream[in] the stream to print on

  • prefix[in] prefix to use on all lines

  • tiling[in] tiling to print

Returns:

0 if successful, an error code otherwise.

struct aml_tiling_ops
#include <aml.h>

aml_tiling_ops is a structure containing a set of operation over a tiling. These operations focus on:

  • retrieving a tile

  • getting information about the size of tiles and the tiling itself.

struct aml_tiling
#include <aml.h>

Implementations