-
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.
Merge branch 'main' into staylor/last_updated_workflow
- Loading branch information
Showing
25 changed files
with
465 additions
and
37 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
50 changes: 50 additions & 0 deletions
50
include/ttmlir/Dialect/TTNN/IR/TTNNOpsBackendInterfaces.td
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,50 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef TTMLIR_TTMLIR_DIALECT_TTNN_TTNNOPSPERFINTERFACES_TD | ||
#define TTMLIR_TTMLIR_DIALECT_TTNN_TTNNOPSPERFINTERFACES_TD | ||
|
||
include "mlir/IR/OpBase.td" | ||
|
||
def TTNNOpBackendInterface : OpInterface<"TTNNOpBackend"> { | ||
let description = [{ | ||
Interface to access a registered method to infer the return types for an | ||
operation that can be used during type inference. | ||
}]; | ||
let cppNamespace = "::mlir::tt::ttnn"; | ||
let methods = [ | ||
InterfaceMethod< | ||
/*desc=*/[{ | ||
Return the op kernel estimate in clock cycles. | ||
}], | ||
/*retTy=*/"size_t", | ||
/*methodName=*/"getOpPerfCycles", | ||
/*args=*/(ins "const std::vector<tt::LayoutAttr>&":$input_layouts, "const tt::LayoutAttr&":$output_layout), | ||
/*methodBody=*/"", | ||
/*defaultImplementation=*/"return std::numeric_limits<size_t>::max();" | ||
>, | ||
InterfaceMethod< | ||
/*desc=*/[{ | ||
Return the op kernel estimate in clock cycles. | ||
}], | ||
/*retTy=*/"size_t", | ||
/*methodName=*/"getOpL1Usage", | ||
/*args=*/(ins "const std::vector<tt::LayoutAttr>&":$input_layouts, "const tt::LayoutAttr&":$output_layout), | ||
/*methodBody=*/"", | ||
/*defaultImplementation=*/"return 0;" | ||
>, | ||
InterfaceMethod< | ||
/*desc=*/[{ | ||
Return the op kernel estimate in clock cycles. | ||
}], | ||
/*retTy=*/"bool", | ||
/*methodName=*/"isOpLegal", | ||
/*args=*/(ins "const std::vector<tt::LayoutAttr>&":$input_layouts, "const tt::LayoutAttr&":$output_layout), | ||
/*methodBody=*/"", | ||
/*defaultImplementation=*/"return true;" | ||
>, | ||
]; | ||
} | ||
|
||
#endif // TTMLIR_TTMLIR_DIALECT_TTNN_TTNNOPSPERFINTERFACES_TD |
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,34 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "ttmlir/Dialect/TTNN/IR/TTNNOps.h" | ||
|
||
#include "ttmlir/Dialect/TTNN/IR/TTNNOpsBackendInterfaces.cpp.inc" | ||
|
||
namespace mlir::tt::ttnn { | ||
|
||
//===----------------------------------------------------------------------===// | ||
// ReluOp | ||
//===----------------------------------------------------------------------===// | ||
|
||
// // Relu backend interface | ||
size_t ReluOp::getOpPerfCycles(const std::vector<tt::LayoutAttr> &input_layouts, | ||
const tt::LayoutAttr &output_layout) { | ||
// Implement a custom estimate for relu op cycles. | ||
return 5; | ||
} | ||
|
||
size_t ReluOp::getOpL1Usage(const std::vector<tt::LayoutAttr> &input_layouts, | ||
const tt::LayoutAttr &output_layout) { | ||
// Implement a custom estimate for relu op L1 usage. | ||
return 10; | ||
} | ||
|
||
bool ReluOp::isOpLegal(const std::vector<tt::LayoutAttr> &input_layouts, | ||
const tt::LayoutAttr &output_layout) { | ||
// Implement a custom check for relu op legality. | ||
return true; | ||
} | ||
|
||
} // namespace mlir::tt::ttnn |
Oops, something went wrong.