-
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.
memory layout analysis policy flag incorporated into both optimizer p…
…ass and TTIRToTTNNBackendPipeline
- Loading branch information
1 parent
f723ac7
commit a93e83a
Showing
13 changed files
with
92 additions
and
80 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
include/ttmlir/Dialect/TT/Utils/MemoryLayoutAnalysisParams.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,47 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef TTMLIR_DIALECT_TT_UTILS_MEMORYLAYOUTANALYSIS_H | ||
#define TTMLIR_DIALECT_TT_UTILS_MEMORYLAYOUTANALYSIS_H | ||
|
||
#include <llvm/ADT/StringSwitch.h> | ||
#include <llvm/Support/CommandLine.h> | ||
|
||
namespace mlir::tt { | ||
|
||
enum class MemoryLayoutAnalysisPolicyType { DFSharding, L1Interleaved }; | ||
|
||
struct MemoryLayoutAnalysisPolicyTypeParser | ||
: public llvm::cl::parser<MemoryLayoutAnalysisPolicyType> { | ||
public: | ||
MemoryLayoutAnalysisPolicyTypeParser(llvm::cl::Option &opt) | ||
: llvm::cl::parser<MemoryLayoutAnalysisPolicyType>(opt) {} | ||
|
||
bool parse(llvm::cl::Option &opt, llvm::StringRef argName, | ||
llvm::StringRef arg, MemoryLayoutAnalysisPolicyType &value) { | ||
value = llvm::StringSwitch<MemoryLayoutAnalysisPolicyType>(arg) | ||
.Case("DFSharding", MemoryLayoutAnalysisPolicyType::DFSharding) | ||
.Case("L1Interleaved", | ||
MemoryLayoutAnalysisPolicyType::L1Interleaved); | ||
return false; | ||
} | ||
|
||
static void print(llvm::raw_ostream &os, | ||
const MemoryLayoutAnalysisPolicyType &value) { | ||
llvm::StringRef policy; | ||
switch (value) { | ||
case MemoryLayoutAnalysisPolicyType::DFSharding: | ||
policy = "DFSharding"; | ||
break; | ||
case MemoryLayoutAnalysisPolicyType::L1Interleaved: | ||
policy = "L1Interleaved"; | ||
break; | ||
} | ||
os << "memory-layout-analysis-policy=" << policy << "\n"; | ||
} | ||
}; | ||
|
||
} // namespace mlir::tt | ||
|
||
#endif // TTMLIR_DIALECT_TT_UTILS_MEMORYLAYOUTANALYSIS_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
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
Oops, something went wrong.