Replies: 4 comments 2 replies
-
Thanks for the RFC @apbose . A few comments here:
|
Beta Was this translation helpful? Give feedback.
-
Yeah I think it'd be good if we consolidate the FX based conversion effort (including pt 2.0) to the pytorch/TensorRT codebase where we already have support for a lot of of the pytorch ops and they are being extensively used/tested. |
Beta Was this translation helpful? Give feedback.
-
@apbose @narendasan can you confirm here if this will be still useful after proxy_tensor & aten ops are the path in FX? |
Beta Was this translation helpful? Give feedback.
-
@ncomly-nvidia :we have another 20 or so converters that can be open-sourced to support this effort. Some of those converters support dynamic shapes. Though that means editing torch2trt.py file as well but that's not a big lift. |
Beta Was this translation helpful? Give feedback.
-
torch2trt converters to bootstrap FX converter library
TL;DR
Bootstrap the FX frontend converter library with the Torch Script writing aten -> TRT converters in torch2trt converters https://github.com/NVIDIA-AI-IOT/torch2trt
Goal(s)
The converter library in torch2trt has more operations support as compared to fx2trt. The goal is to leverage this and incorporate it in the fx2trt design flow. The primary goal of this document is highlight the next steps - API design, code flow, and the use cases to enhance the present converter library in fx2trt
Usecases
Currently fx2trt supports the following converters- adaptive_avgpool, activation, add, batchnorm, convolution, div, linear, maxpool, mul,pow, relu, sub and reshape operations. torch2trt has a bunch of converters which are registered using the tensorrt_converter decorater in the same way as the converters are registered in fx2trt. Goal is to support the missing operations and create a generic interface for fx converters which will then be used for the aten2trt interface
Proposed APIs / UX
In torch2trt the converters are registered in the CONVERTERS dictionary. The conversion context in torch2trt and fx2trt behave in the same way. It attaches the converters to the torch method calls. Currently the acc_ops have the same syntax as aten ops due to which they are reused.
Design
The tensorrt_converter object attaches the converter to the torch method calls in the trace. Aten and acc converters have different protorypes. A common conversion context should wrap up inputs and arguments in such a way, that the interface should be common to the acc and aten tracer.
Implementation Phases
For this the following changes are to be made-
-The input signature for the converters in aten and acc is same, but the way arguments are packed is different.
eg:
Aten trace
Acc trace
In the above example fx2trt can maintain a common Conversion context in which the arguments can be passed for Aten and Acc Tracer
For the missing converters, the converters from torch2trt can be used directly
Prototype - M
MVP
(<TARGET RELEASE VERSION>)
- SBeta Was this translation helpful? Give feedback.
All reactions