-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update Update
- Loading branch information
Showing
25 changed files
with
213 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef TRITON_IR_OP_INTERFACES_H_ | ||
#define TRITON_IR_OP_INTERFACES_H_ | ||
|
||
#include "mlir/IR/OpDefinition.h" | ||
|
||
#include "triton/Dialect/Triton/IR/Utility.h" | ||
|
||
namespace mlir { | ||
|
||
namespace triton { | ||
|
||
namespace impl { | ||
|
||
LogicalResult verifyTransposeOpInterface(Operation *op); | ||
|
||
} // namespace impl | ||
|
||
} // namespace triton | ||
} // namespace mlir | ||
|
||
#include "triton/Dialect/Triton/IR/OpInterfaces.h.inc" | ||
|
||
#endif // TRITON_IR_OP_INTERFACES_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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ add_triton_library(TritonIR | |
Ops.cpp | ||
Traits.cpp | ||
Types.cpp | ||
OpInterfaces.cpp | ||
|
||
DEPENDS | ||
TritonTableGen | ||
|
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,33 @@ | ||
#include "mlir/IR/Diagnostics.h" | ||
#include "mlir/Support/LogicalResult.h" | ||
|
||
#include "triton/Dialect/Triton/IR/OpInterfaces.h" | ||
#include "triton/Dialect/Triton/IR/Types.h" | ||
|
||
namespace mlir { | ||
namespace triton { | ||
namespace impl { | ||
|
||
LogicalResult verifyTransposeOpInterface(Operation *op) { | ||
TransposeOpInterface transposeOp = cast<TransposeOpInterface>(op); | ||
auto rank = transposeOp.getRank(); | ||
auto order = transposeOp.getOrder(); | ||
if (rank != order.size()) { | ||
return op->emitError( | ||
"order must have the same size as the rank of the operand and result"); | ||
} | ||
|
||
SmallVector<int32_t, 8> sortedOrder(order); | ||
llvm::sort(sortedOrder); | ||
for (int32_t i = 0; i < sortedOrder.size(); i++) { | ||
if (sortedOrder[i] != i) { | ||
return op->emitError("order must be a permutation of [0, ..., rank - 1]"); | ||
} | ||
} | ||
|
||
return success(); | ||
} | ||
|
||
} // namespace impl | ||
} // namespace triton | ||
} // namespace mlir |
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.