untilize

void ckernel::untilize_init(uint32_t icb)

Initializes the hardware and internal state for the untilize operation. This function should be called before performing any untilize operations in the compute kernel. The circular buffer (CB) ID provided must correspond to the buffer containing the input data to be untilized. If the data format or properties of the input operand differ from those previously configured, ensure that the appropriate reconfiguration functions are called before this initialization.

Return value: None

Param Type

Name

Description

Type

Valid Range

Required

Function

icb

The identifier of the circular buffer (CB) for input data

uint32_t

0 to 31

True

template<uint32_t block_ct_dim = 1>
void ckernel::untilize_block(uint32_t icb, uint32_t full_ct_dim, uint32_t ocb)

Copies a block of tiles from the DEST register buffer to the specified circular buffer (CB) for the untilize operation. This function is used to transfer multiple tiles at once, with the number of tiles determined by the template parameter block_ct_dim. The DEST register buffer must be in the acquired state before calling this function. The CB ID provided must correspond to the buffer where the untilized data will be stored. Note that the maximum size of the block is limited by the size of the DEST and synchronization mode used. These are maximum sizes:

  • half-sync mode (16-bit mode): 8 tiles

  • half-sync mode (32-bit mode): 4 tiles

  • full-sync mode (16-bit mode): 16 tiles

  • full-sync mode (32-bit mode): 8 tiles

Return value: None

Param Type

Name

Description

Type

Valid Range

Required

Template

block_ct_dim

The number of tiles stored in DEST at one moment

uint32_t

1 to max (see comment)

False

Function

icb

The identifier of the circular buffer (CB) for input

uint32_t

0 to 31

True

Function

full_ct_dim

Width of a full input in tiles

uint32_t

Divisible by block_ct_dim

True

Function

ocb

The identifier of the circular buffer (CB) for output

uint32_t

0 to 31

True

void ckernel::untilize_uninit(uint32_t icb)

Restores hardware and internal state after the untilize operation is complete. This function should be called after untilize_block operation is finished. The circular buffer (CB) ID provided must correspond to the buffer that was used for the untilize operation and it’s initialization.

NOTE: This function is not in line with our programming model, and will be removed by the end of 2025 as a part of tt-metal#22904.

Return value: None

Param Type

Name

Description

Type

Valid Range

Required

Function

icb

The identifier of the circular buffer (CB) for input data

uint32_t

0 to 31

True