Skip to content

Commit

Permalink
format tables for Kernel APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
gsarabandoTT committed Jan 22, 2025
1 parent 621fd1f commit 4e16e18
Show file tree
Hide file tree
Showing 32 changed files with 120 additions and 219 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,11 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform requested operation| uint32_t | Must be
* less than the size of the DST register buffer | True |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | mode | 0, 1, 2, 3, and 4 | uint32_t | 0, 1, 2,
* 3, 4 corresponding to add, mul, sub, div, | True | | | | | and rsub | |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | param1 | fp32 value scalar encoded as uint32 | uint32_t | Must be
* less than the size of the DST register buffer | True |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | Argument | Description | Type | Valid Range | Required |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform requested operation| uint32_t | Must be less than the size of the DST register buffer | True |
* | mode | 0, 1, 2, 3, and 4 | uint32_t | 0, 1, 2, 3, 4 corresponding to add, mul, sub, div, and rsub | True |
* | param1 | fp32 value scalar encoded as uint32 | uint32_t | Must be less than the size of the DST register buffer | True |
*/
enum { ADD_UNARY = 0, SUB_UNARY = 1, MUL_UNARY = 2, DIV_UNARY = 3, RSUB_UNARY = 4 };
ALWI void add_unary_tile(uint32_t idst, uint32_t param1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | param0 | The value the output is if the input
* is greater than 0 | uint32_t | | True |
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | param0 | The value the output is if the input is greater than 0 | uint32_t | | True |
*/
ALWI void bitwise_and_tile(uint32_t idst, uint32_t param0) {
MATH((llk_math_eltwise_unary_sfpu_bitwise_and<APPROX>(idst, param0)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to modify the computation of | uint32_t | Must be
* less than the size of the DST register buffer | True |
* | idst | The index of the tile in DST register buffer to modify the computation of | uint32_t | Must be less than the size of the DST register buffer | True |
*/
ALWI void bitwise_not_tile(uint32_t idst) { MATH((llk_math_eltwise_unary_sfpu_bitwise_not<APPROX>(idst))); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | param0 | The value the output is if the input
* is greater than 0 | uint32_t | | True |
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | param0 | The value the output is if the input is greater than 0 | uint32_t | | True |
*/
ALWI void bitwise_or_tile(uint32_t idst, uint32_t param0) {
MATH((llk_math_eltwise_unary_sfpu_bitwise_or<APPROX>(idst, param0)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | param0 | The value the output is if the input
* is greater than 0 | uint32_t | | True |
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | param0 | The value the output is if the input is greater than 0 | uint32_t | | True |
*/
ALWI void bitwise_xor_tile(uint32_t idst, uint32_t param0) {
MATH((llk_math_eltwise_unary_sfpu_bitwise_xor<APPROX>(idst, param0)));
Expand Down
12 changes: 4 additions & 8 deletions tt_metal/include/compute_kernel_api/eltwise_unary/ceil.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ ALWI void ceil_tile_init() { MATH((llk_math_eltwise_unary_sfpu_ceil_init<APPROX>
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to perform ceil operation | uint32_t | Must be
* less than the size of the DST register buffer | True |
* | idst | The index of the tile in DST register buffer to perform ceil operation | uint32_t | Must be less than the size of the DST register buffer | True |
*/
ALWI void ceil_tile(uint32_t idst) { MATH((llk_math_eltwise_unary_sfpu_ceil<APPROX>(idst))); }

Expand All @@ -44,11 +42,9 @@ ALWI void ceil_tile(uint32_t idst) { MATH((llk_math_eltwise_unary_sfpu_ceil<APPR
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to perform ceil operation | uint32_t | Must be
* less than the size of the DST register buffer | True |
* | idst | The index of the tile in DST register buffer to perform ceil operation | uint32_t | Must be less than the size of the DST register buffer | True |
*/
ALWI void ceil_tile_float32(uint32_t idst) { MATH((llk_math_eltwise_unary_sfpu_ceil_float32<APPROX>(idst))); }

Expand Down
12 changes: 4 additions & 8 deletions tt_metal/include/compute_kernel_api/eltwise_unary/dropout.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | probability | A non-negative integer value
* representing dropout probability | uint32_t | 0 to INT_MAX (float_probability * (double) INT_MAX) |
* True | | | | | Must
* cast INT_MAX to double to avoid numerical errors | | | scale_factor | uint bitwise representation of 32
* bit floating point scale factor | uint32_t | | True |
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | probability | A non-negative integer value representing dropout probability | uint32_t | 0 to INT_MAX (float_probability * (double) INT_MAX) | True |
* | scale_factor | uint bitwise representation of 32 bit floating point scale factor | uint32_t | | True |
*/
ALWI void dropout_tile(uint32_t idst, uint32_t probability, uint32_t scale_factor) {
MATH((llk_math_eltwise_unary_sfpu_dropout<APPROX>(idst, probability, scale_factor)));
Expand Down
8 changes: 3 additions & 5 deletions tt_metal/include/compute_kernel_api/eltwise_unary/elu.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | slope | slope used in elu calculation |
* uint32_t | Greater than 0 | True |
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | slope | slope used in elu calculation | uint32_t | Greater than 0 | True |
*/
ALWI void elu_tile(uint32_t idst, uint32_t param0) { MATH((llk_math_eltwise_unary_sfpu_elu<APPROX>(idst, param0))); }

Expand Down
12 changes: 4 additions & 8 deletions tt_metal/include/compute_kernel_api/eltwise_unary/erf_erfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ ALWI void erf_tile_init() {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True |
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
*/
template <bool fast_and_approx = true>
ALWI void erf_tile(uint32_t idst) {
Expand All @@ -61,11 +59,9 @@ ALWI void erfc_tile_init() {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True |
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
*/
template <bool fast_and_approx = true>
ALWI void erfc_tile(uint32_t idst) {
Expand Down
8 changes: 3 additions & 5 deletions tt_metal/include/compute_kernel_api/eltwise_unary/exp.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ ALWI void exp_tile_init() {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | fast_and_approx | Computation to be done faster and
* approximate | bool | | False |
* | tile_index | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | fast_and_approx | Computation to be done faster and approximate | bool | | False |
*/
template <bool fast_and_approx = false>
ALWI void exp_tile(uint32_t idst) {
Expand Down
8 changes: 3 additions & 5 deletions tt_metal/include/compute_kernel_api/eltwise_unary/fill.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ namespace ckernel {
*
* Return value: None
*
* | Argument | Description | Type | Valid
* Range | Required |
* | Argument | Description | Type | Valid Range | Required |
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------|
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be
* less than the size of the DST register buffer | True | | param0 | The value the output is if the input
* is greater than 0 | uint32_t | | True |
* | idst | The index of the tile in DST register buffer to perform the computation on | uint32_t | Must be less than the size of the DST register buffer | True |
* | param0 | The value the output is if the input is greater than 0 | uint32_t | | True |
*/
ALWI void fill_tile(uint32_t idst, uint32_t param0) { MATH((llk_math_eltwise_unary_sfpu_fill<APPROX>(idst, param0))); }

Expand Down
Loading

0 comments on commit 4e16e18

Please sign in to comment.