-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13385: Low-level interface for
ttnn.round
on Wormhole
- Loading branch information
Showing
5 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tt_metal/hw/ckernels/wormhole_b0/metal/llk_api/llk_sfpu/llk_math_eltwise_unary_sfpu_round.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include "llk_math_eltwise_unary_sfpu_init.h" | ||
#include "llk_math_eltwise_unary_sfpu_params.h" | ||
#include "ckernel_sfpu_round.h" | ||
|
||
namespace ckernel { | ||
|
||
// New LLK SFPU APIs | ||
|
||
template <bool APPROXIMATE> | ||
inline void llk_math_eltwise_unary_sfpu_round_init() { | ||
llk_math_eltwise_unary_sfpu_init<SfpuType::round, APPROXIMATE>(); | ||
} | ||
|
||
template <bool APPROXIMATE> | ||
inline void llk_math_eltwise_unary_sfpu_round(uint dst_index, int vector_mode = (int)VectorMode::RC) { | ||
llk_math_eltwise_unary_sfpu_params<APPROXIMATE> | ||
(ckernel::sfpu::calculate_round<APPROXIMATE>, | ||
dst_index, vector_mode); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,5 +87,6 @@ enum SfpuType { | |
ceil, | ||
unused, | ||
reshuffle_rows, | ||
cumsum | ||
cumsum, | ||
round, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
|
||
#include "compute_kernel_api/common_globals.h" | ||
#ifdef TRISC_MATH | ||
#include "llk_math_eltwise_unary_sfpu_round.h" | ||
#define MAIN math_main() | ||
#define MATH(x) x | ||
#else | ||
#define MATH(x) | ||
#endif | ||
|
||
|
||
|
||
namespace ckernel { | ||
|
||
/** | ||
* Please refer to documentation for any_init. | ||
*/ | ||
ALWI void round_tile_init() { | ||
MATH(( llk_math_eltwise_unary_sfpu_round_init<APPROX>() )); | ||
} | ||
|
||
/** | ||
* Performs round operation on each row of a tile. | ||
* in DST register at index tile_index. The DST register buffer must be in | ||
* acquired state via *acquire_dst* call. This call is blocking and is only | ||
* available on the compute engine. | ||
* | ||
* Return value: None | ||
* | ||
* | Argument | Description | Type | Valid Range | Required | | ||
* |-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------|----------| | ||
* | idst | The index of the tile in DST register buffer to modify the sign bit of | uint32_t | Must be less than the size of the DST register buffer | True | | ||
*/ | ||
ALWI void round_tile(uint32_t idst) { | ||
MATH(( llk_math_eltwise_unary_sfpu_round<APPROX>(idst) )); | ||
} | ||
|
||
|
||
} // namespace ckernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters