Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default call to createConvertTorchToTcpPass #18

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/mlir-tcp/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def ConvertTorchToTcp : Pass<"convert-torch-to-tcp", "func::FuncOp"> {
let description = [{
Convert Torch ops to Tcp ops.
}];
let constructor = "mlir::tcp::createConvertTorchToTcpPass(/*convertTorchOps=*/{})";
let constructor = "mlir::tcp::createConvertTorchToTcpPass()";
let options = [
ListOption<"convertTorchOps", "convert-torch-ops", "std::string",
"List of Torch operation names that should be converted to Tcp",
"llvm::cl::ZeroOrMore">
"llvm::cl::ZeroOrMore">,
];
}

Expand Down
1 change: 1 addition & 0 deletions include/mlir-tcp/Conversion/TorchToTcp/TorchToTcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace mlir {

namespace tcp {

std::unique_ptr<OperationPass<func::FuncOp>> createConvertTorchToTcpPass();
std::unique_ptr<OperationPass<func::FuncOp>>
createConvertTorchToTcpPass(llvm::ArrayRef<std::string> convertTorchOps);

Expand Down
5 changes: 5 additions & 0 deletions lib/Conversion/TorchToTcp/TorchToTcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class ConvertTorchToTcp : public ConvertTorchToTcpBase<ConvertTorchToTcp> {

} // namespace

std::unique_ptr<OperationPass<func::FuncOp>> createConvertTorchToTcpPass() {
llvm::ArrayRef<std::string> emptyArrayRef;
return std::make_unique<ConvertTorchToTcp>(/*convertTorchOps=*/emptyArrayRef);
}

std::unique_ptr<OperationPass<func::FuncOp>>
createConvertTorchToTcpPass(llvm::ArrayRef<std::string> convertTorchOps) {
return std::make_unique<ConvertTorchToTcp>(convertTorchOps);
Expand Down
2 changes: 1 addition & 1 deletion lib/Pipeline/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
using namespace mlir;

static void createTorchBackendToTcpBackendPipeline(OpPassManager &pm) {
pm.addNestedPass<func::FuncOp>(tcp::createConvertTorchToTcpPass({}));
pm.addNestedPass<func::FuncOp>(tcp::createConvertTorchToTcpPass());

// Clean up any non-canonical code introduced above.
pm.addNestedPass<func::FuncOp>(createCanonicalizerPass());
Expand Down