-
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.
[Optimizer] Add df and layout overrides (#1148)
Also move optimizer overrides to TTNN/
- Loading branch information
1 parent
4c6711d
commit ae93524
Showing
15 changed files
with
328 additions
and
221 deletions.
There are no files selected for viewing
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 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,55 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef TTMLIR_DIALECT_TT_UTILS_OVERRIDEPARAMS_H | ||
#define TTMLIR_DIALECT_TT_UTILS_OVERRIDEPARAMS_H | ||
|
||
#include "ttmlir/Dialect/TT/IR/TTOpsTypes.h" | ||
#include "ttmlir/Dialect/TTNN/IR/TTNNOpsAttrs.h" | ||
#include <cstdint> | ||
#include <llvm/Support/CommandLine.h> | ||
|
||
namespace mlir::tt::ttnn { | ||
|
||
struct OutputLayoutOverrideParams { | ||
SmallVector<int64_t, 2> grid; | ||
tt::MemorySpace memorySpace; | ||
tt::TensorMemoryLayout tensorMemoryLayout; // INTERLEAVED / SHARDED etc... | ||
tt::ttnn::Layout memoryLayout; // ROW_MAJOR / TILE | ||
tt::DataType dataType; | ||
}; | ||
|
||
struct InputLayoutOverrideParams { | ||
SmallVector<int64_t> operandIdxes; | ||
}; | ||
|
||
struct OutputLayoutOverrideParser | ||
: public llvm::cl::parser<llvm::StringMap<OutputLayoutOverrideParams>> { | ||
public: | ||
OutputLayoutOverrideParser(llvm::cl::Option &opt) | ||
: llvm::cl::parser<llvm::StringMap<OutputLayoutOverrideParams>>(opt) {} | ||
|
||
bool parse(llvm::cl::Option &opt, StringRef argName, StringRef arg, | ||
llvm::StringMap<OutputLayoutOverrideParams> &value); | ||
|
||
static void print(llvm::raw_ostream &os, | ||
const llvm::StringMap<OutputLayoutOverrideParams> &value); | ||
}; | ||
|
||
struct InputLayoutOverrideParser | ||
: public llvm::cl::parser<llvm::StringMap<InputLayoutOverrideParams>> { | ||
public: | ||
InputLayoutOverrideParser(llvm::cl::Option &opt) | ||
: llvm::cl::parser<llvm::StringMap<InputLayoutOverrideParams>>(opt) {} | ||
|
||
bool parse(llvm::cl::Option &opt, StringRef argName, StringRef arg, | ||
llvm::StringMap<InputLayoutOverrideParams> &value); | ||
|
||
static void print(llvm::raw_ostream &os, | ||
const llvm::StringMap<InputLayoutOverrideParams> &value); | ||
}; | ||
|
||
} // namespace mlir::tt::ttnn | ||
|
||
#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
Oops, something went wrong.