exp_tile

template<bool approx = false, uint32_t scale = 0x3F800000, InputClamping input_clamping = InputClamping::ClampToNegative, bool is_fp32_dest_acc_en = DST_ACCUM_MODE>
void ckernel::exp_tile_init()

Please refer to documentation for any_init.

Template scale parameter is used when approx is true and exp_tile is called with scale_en set to true.

Also programs the SFPU state that exp_tile’s body reads: the shared programmable constants (vConstFloatPrgm0..2, LREG12..14) and, in approx mode, the load macros. Which of them each path reads is in the note on exp_tile.

template<bool approx = false, bool scale_en = false, InputClamping input_clamping = InputClamping::ClampToNegative, int iterations = 8, bool is_fp32_dest_acc_en = DST_ACCUM_MODE>
void ckernel::exp_tile(uint32_t idst, VectorMode vector_mode = VectorMode::RC, uint16_t scale = p_sfpu::kCONST_1_FP16B)

Performs element-wise computation of exponential on each element of a tile in the DST register. The DST register buffer must be in an acquired state via an acquire_dst call. This call is blocking and is only available on the compute engine.

The body reads SFPU state that exp_tile_init programs and that other SFPU ops’ inits (recip_tile_init among them) overwrite. What it reads depends on the mode, the DEST format and the architecture:

  • approx: LREG12..14 (vConstFloatPrgm0..2) and, unless DISABLE_SFPLOADMACRO, the load macros, on Wormhole and Blackhole;

  • accurate on a bf16 DEST: LREG12..13 (vConstFloatPrgm0..1), on Wormhole and Blackhole;

  • accurate on an fp32 DEST: LREG12..14 (vConstFloatPrgm0..2), on Wormhole and Blackhole. So call exp_tile_init again after any other SFPU init before the next exp_tile. Interleaving ops without their inits silently returns wrong values; there is no assert.

Return value: None

Template Parameter Description

approx Enable approximate mode.

scale_en Enable input scaling by a constant factor in approximate or non-approximate mode

input_clamping If approx, controls whether very negative inputs are clamped to prevent incorrect outputs

iterations Number of iterations over 32-SFPU lanes to run

Argument Description

idst The index of the tile in DST register buffer to perform the computation on

vector_mode Specifies the vector mode for computation (default: VectorMode::RC)

scale Scale factor to apply in approximate or non-approximate mode if scale_en is true (default: 0x3F80, 1.0f in FP16b)