-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added abstraction to MemoryLayoutAnalysis policy and removed unnecessary
tests.
- Loading branch information
1 parent
a93e83a
commit 0194e80
Showing
8 changed files
with
52 additions
and
185 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
39 changes: 39 additions & 0 deletions
39
include/ttmlir/Dialect/TTNN/Analysis/MemoryLayoutAnalysisPolicy.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,39 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef TTMLIR_DIALECT_TTNN_ANALYSIS_MEMORYLAYOUTANALYSISPOLICY_H | ||
#define TTMLIR_DIALECT_TTNN_ANALYSIS_MEMORYLAYOUTANALYSISPOLICY_H | ||
|
||
#include "mlir/Dialect/Func/IR/FuncOps.h" | ||
#include "ttmlir/Dialect/TTNN/Analysis/L1ChainConfig.h" | ||
|
||
namespace mlir::tt::ttnn { | ||
|
||
class MemoryLayoutAnalysisPolicy { | ||
protected: | ||
Operation *rootOp; | ||
std::vector<L1ChainConfig> *l1ChainConfigs; | ||
llvm::DenseMap<Operation *, std::vector<tt::LayoutAttr>> legalLayouts; | ||
llvm::DenseMap<func::FuncOp, llvm::SmallVector<Operation *>> *schedule; | ||
unsigned usableL1CacheSize = 0; | ||
|
||
public: | ||
virtual ~MemoryLayoutAnalysisPolicy() {}; | ||
|
||
MemoryLayoutAnalysisPolicy( | ||
Operation *rootOp, std::vector<L1ChainConfig> &l1ChainConfigs, | ||
const llvm::DenseMap<Operation *, std::vector<tt::LayoutAttr>> | ||
&legalLayouts, | ||
llvm::DenseMap<func::FuncOp, llvm::SmallVector<Operation *>> &schedule, | ||
unsigned usableL1CacheSize) | ||
: rootOp(rootOp), l1ChainConfigs(&l1ChainConfigs), | ||
legalLayouts(legalLayouts), schedule(&schedule), | ||
usableL1CacheSize(usableL1CacheSize) {} | ||
|
||
virtual void run(const std::unordered_set<Edge> &overrideReshardEdges) = 0; | ||
}; | ||
|
||
} // namespace mlir::tt::ttnn | ||
|
||
#endif // TTMLIR_DIALECT_TTNN_ANALYSIS_MEMORYLAYOUTANALYSISPOLICY_H |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.