-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add E2E implementation of reduce prod op along with StableHLO convers…
…ion (#1792)
- Loading branch information
1 parent
59d6008
commit d5b4d1a
Showing
28 changed files
with
584 additions
and
5 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
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
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
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
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
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
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
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
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
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
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
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,35 @@ | ||
// SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "operations/reduction/prod.h" | ||
#include "tt/runtime/detail/logger.h" | ||
#include "tt/runtime/detail/ttnn.h" | ||
#include "tt/runtime/ttnn/operations/utils.h" | ||
#include "tt/runtime/ttnn/utils.h" | ||
|
||
namespace tt::runtime::ttnn::operations::reduction { | ||
static void runReductionProdOp(::tt::target::ttnn::ReductionProdOp const *op, | ||
ProgramTensorPool &tensorPool) { | ||
|
||
std::optional<::tt::tt_metal::MemoryConfig> outputMemoryConfig = | ||
op->memcfg() ? std::make_optional( | ||
utils::createMemoryConfig(op->memcfg(), op->out())) | ||
: std::nullopt; | ||
|
||
const ::ttnn::Tensor &in = tensorPool.at(op->in()->global_id()); | ||
DEBUG_ASSERT(in.is_allocated()); | ||
|
||
::ttnn::Tensor out = | ||
::ttnn::prod(in, op->all_dimensions(), op->dim_arg(), op->keep_dim(), | ||
outputMemoryConfig /* memory_config_arg */); | ||
|
||
tensorPool.insert_or_assign(op->out()->global_id(), out); | ||
} | ||
|
||
void run(const ::tt::target::ttnn::ReductionProdOp *op, | ||
ProgramContext &context) { | ||
ProgramTensorPool &tensorPool = context.getTensorPool(); | ||
runReductionProdOp(op, tensorPool); | ||
} | ||
} // namespace tt::runtime::ttnn::operations::reduction |
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,16 @@ | ||
// SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef RUNTIME_LIB_TTNN_OPERATIONS_REDUCTION_PROD_H | ||
#define RUNTIME_LIB_TTNN_OPERATIONS_REDUCTION_PROD_H | ||
|
||
#include "tt/runtime/ttnn/types.h" | ||
#include "ttmlir/Target/TTNN/program_generated.h" | ||
|
||
namespace tt::runtime::ttnn::operations::reduction { | ||
void run(const ::tt::target::ttnn::ReductionProdOp *op, | ||
ProgramContext &context); | ||
} // namespace tt::runtime::ttnn::operations::reduction | ||
|
||
#endif |
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.