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

Separate conversion pass for torch -> tcp.custom_op to support both kernel and codegen approaches #19

Merged

Conversation

sjain-stanford
Copy link
Collaborator

@sjain-stanford sjain-stanford commented Nov 4, 2023

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.

@sjain-stanford sjain-stanford changed the title Separate conversion pass for torch -> tcp.custom_op Separate conversion pass for torch -> tcp.custom_op to support both kernel and codegen approaches Nov 4, 2023
@sjain-stanford sjain-stanford marked this pull request as ready for review November 4, 2023 18:53
@sjain-stanford sjain-stanford requested review from sanjoy, navahgar and a team November 4, 2023 18:53
@@ -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);
Copy link
Contributor

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>({})

Copy link
Collaborator Author

@sjain-stanford sjain-stanford Nov 5, 2023

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)
    ^

@sjain-stanford
Copy link
Collaborator Author

@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.

@sjain-stanford sjain-stanford merged commit 32c2532 into cruise-automation:main Nov 5, 2023
1 check passed
@sjain-stanford sjain-stanford deleted the sambhav/custom_op_pass branch November 5, 2023 14:39
srinathava pushed a commit to srinathava/mlir-tcp that referenced this pull request Jun 24, 2024
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/...`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants