-
Notifications
You must be signed in to change notification settings - Fork 7
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
Separate conversion pass for torch -> tcp.custom_op
to support both kernel and codegen approaches
#19
Separate conversion pass for torch -> tcp.custom_op
to support both kernel and codegen approaches
#19
Conversation
torch
-> tcp.custom_op
torch -> tcp.custom_op
to support both kernel and codegen approaches
@@ -97,6 +94,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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be std::make_unique<ConvertTorchToTcp>({})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially had that, but hit this compiler error:
lib/Conversion/TorchToTcp/TorchToTcp.cpp:99:10: error: no matching function for call to 'make_unique'
return std::make_unique<ConvertTorchToTcp>({});
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/unique_ptr.h:961:5: note: candidate template ignored: substitution failure [with _Tp = mlir::tcp::(anonymous namespace)::ConvertTorchToTcp]: deduced incomplete pack <(no value)> for template parameter '_Args'
make_unique(_Args&&... __args)
^
15eceea
to
580dd76
Compare
@navahgar I am about to land this under the assumption that it addresses your comment about tcp.gather codegen. Please let me know if it doesn't or if you have any other feedback, and I'll be glad to take it up in a follow-on. |
Replace the tcp custom op for `torch.tensorrt.execute_engine_variadic` to `tensorrt.execute_engine` for generic usage purpose. To test, from c/c repo: `bazel test @mlir-tcp//test/...`
This allows switching between codegen vs kernels approaches, for torch ops that can lower to either tcp ops (codegen) or tcp.custom_op (kernel). Addresses #17 (comment) using Option 2.