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
support multi_scale_deform_attn trt plugin #1844
Conversation
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.
There are some works to do for you:
- add symbolic rewriting of this op in MMDeploy to export ONNX.
- add corresponding unit test
- update doc description for customized ops
BTW, what model does this op work for?
Please fix the lint issue. You can install pre-commit hook on your localhost like following: pip install -U pre-commit
cd mmdeploy
pre-commit install You can run As for cscr files, you may try |
|
csrc/mmdeploy/backend_ops/tensorrt/multi_scale_deform_attn/trt_ms_deform_attn_kernel.hpp
Outdated
Show resolved
Hide resolved
If your code is modified from other repo, please add some comment at the head of the file like https://github.com/open-mmlab/mmdeploy/blob/master/csrc/mmdeploy/backend_ops/torchscript/optimizer/ir/subgraph_matcher.cpp . |
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.
Unit test failed with log:
FAILED tests/test_ops/test_ops.py::test_multi_scale_deformable_attn[backend0] - RuntimeError: CUDA error: an illegal memory access was encountered
csrc/mmdeploy/backend_ops/tensorrt/multi_scale_deform_attn/trt_ms_deform_attn_kernel.cu
Outdated
Show resolved
Hide resolved
16d7c1e
to
0a65320
Compare
result mismatch
|
The mismatch is caused by input[1] & input[2] point to the same address in plugin.cpp, input[1] and input [2] should difference |
Sorry, It is my mistake. mmdeploy/mmdeploy/backend/tensorrt/wrapper.py Line 155 in 34c6866
input_tensor will be released after the loop, that leads to the error. You can initialize the inputs before the for loop: inputs = dict((name, data.contiguous().int() if data.dtype ==
torch.long else data.contiguous())
for name, data in inputs.items())
for input_name, input_tensor in inputs.items():
... Could you please fix it for me in this PR. |
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.
LGTM
fixed
fixed |
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.
LGTM
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
This trt plugin refers to mmcv and tensorrt
Modification
Please briefly describe what modification is made in this PR.
BC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist