-
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.
- Loading branch information
1 parent
9d731b7
commit 4974fcf
Showing
19 changed files
with
1,104 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
#ifndef TTMLIR_TTMLIR_DIALECT_TTNN_IR_TTNN_WORKAROUND_INTERFACE_H | ||
#define TTMLIR_TTMLIR_DIALECT_TTNN_IR_TTNN_WORKAROUND_INTERFACE_H | ||
|
||
#include "mlir/IR/Operation.h" | ||
#include "ttmlir/Dialect/TTNN/IR/TTNNWorkarounds.h" | ||
|
||
namespace mlir::tt::ttnn::wa { | ||
// Gets default operand workarounds for the given operation. This method is | ||
// called from the TTNNWorkaroundInterface and its getOperandsWorkarounds | ||
// method. | ||
TTNNOperandsWorkarounds getDefaultOperandWorkarounds(Operation *op); | ||
|
||
// Verifies the TTNNWorkaroundInterface | ||
mlir::LogicalResult verifyTTNNWorkaroundInterface(mlir::Operation *op); | ||
} // namespace mlir::tt::ttnn::wa | ||
|
||
#include "ttmlir/Dialect/TTNN/IR/TTNNWorkaroundInterface.h.inc" | ||
|
||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-FileCopyrightText: (c) 2024 Tenstorrent AI ULC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef TTMLIR_TTMLIR_DIALECT_TTNN_IR_TTNN_WORKAROUND_INTERFACE_TD | ||
#define TTMLIR_TTMLIR_DIALECT_TTNN_IR_TTNN_WORKAROUND_INTERFACE_TD | ||
|
||
include "mlir/IR/OpBase.td" | ||
|
||
// This interface is used to specify workarounds for TTNN operations. | ||
def TTNN_WorkaroundInterface : OpInterface<"TTNNWorkaroundInterface"> { | ||
let cppNamespace = "::mlir::tt::ttnn::wa"; | ||
let methods = [ | ||
InterfaceMethod< | ||
/*desc=*/[{ | ||
Returns the workarounds associated with each operand and result of this operation. | ||
If the operation is a Destination-Passing Style (DPS) operation, the same workarounds | ||
must apply to both the DPS initial operands and the operation results. These constraints | ||
are verified through the interface verifier. | ||
|
||
For example, consider the following ttnn operations: | ||
%0 = "ttnn.emptyOp"() : () -> tensor<1x1xf32> | ||
%1 = "ttnn.abs"(%arg0, %0) : (tensor<1x1xf32>, tensor<1x1xf32>) -> tensor<1x1xf32> | ||
|
||
In this example: | ||
- The ttnn.abs operation has two input operand workarounds. | ||
- It has one output operand workaround. | ||
- The output workaround must match the workaround for the second input operand, | ||
ensuring consistency as required by the DPS pattern. | ||
}], | ||
/*retTy=*/"TTNNOperandsWorkarounds", | ||
/*methodName=*/"getOperandsWorkarounds", | ||
/*args=*/(ins), | ||
/*methodBody=*/"", | ||
/*defaultImplementation=*/[{ | ||
return getDefaultOperandWorkarounds(this->getOperation()); | ||
}] | ||
>, | ||
]; | ||
|
||
let verify = [{ | ||
return verifyTTNNWorkaroundInterface($_op); | ||
}]; | ||
} | ||
|
||
#endif |
Oops, something went wrong.