Replies: 2 comments
-
This plan overall looks good to me - I have a few comments/clarification requests. Number 1 and 3 are similar. 1. For intermediate subgraphs which we turn into TRT engines, how would we determine the ranges of the input tensors from the user-provided shapes, in both the
2. Does the fact that users can specify options to the backend for torch.compile(model, backend="torch_tensorrt", options={"min_block_size": 4, ...}) 3. With the amount of graph modification that Dynamo + AOT perform, what is a reliable way to map subgraph inputs to user-provided inputs?
|
Beta Was this translation helpful? Give feedback.
-
We should be adding support for disjoint optimization ranges which is something we missed in TorchScript |
Beta Was this translation helpful? Give feedback.
-
Dynamic shape support in dynamo
TL;DR
In line with Torchscript front end, we should support dynamic shapes in dynamo workflow by using torch_tensorrt.Input(min_shape=<>, opt_shape=<>, max_shape=<>) and passing it to torch_tensorrt.compile.
Goals
The current workflow for TS is really convenient for users to input dynamic shapes to the model. Using the same workflow will be helpful for users to port their code to dynamo easily.
Usecase that we can't support directly is from torch.compile.
One workflow for dynamo is
This can't be used since there is no clean way to provide dynamic shape info for inputs.
Proposed APIs / UX / Internal implementation
We would create
input_to_dynamic_range
mapping and pass it as an attribute toCompilationSettings
object.input_to_dynamic_range
can have keys namedinput0
,input1
etc.This mapping should be used in conjunction to the
inputs
list here https://github.com/pytorch/TensorRT/blob/main/py/torch_tensorrt/dynamo/backend/conversion.py#L29 to createtorch_tensorrt.Input
objects which have the dynamic shape information.Details specific for TorchScript Support
Implementation exists.
Details specific for FX support
No changes here. This support already exists in
fx_ts_compat
Implementation Phases
Prototype - Medium
MVP
2.0
- Small / MediumFuture work / Extensions
dynamic
flag intorch.compile
to see if we can make use of the symbolic shapes it returns.Beta Was this translation helpful? Give feedback.
All reactions