Description
🚀 The feature, motivation and pitch
Torch-TensorRT has two workflows (torch.export based and torch.compile based) for optimizing Pytorch models using TensorRT.
-
torch.export.export()
flow can accept dynamic shapes withmin
andmax
ranges specified for any input dimension. This range information can be accessible for intermediate nodes in the graph vianode.shape_env.var_to_range
. TensorRT uses this range information when building engines (with dynamic shapes). -
torch.compile
providestorch._dynamo.mark_dynamic(tensor, dim)
which is great. But can this be extended to accept ranges (or something similar totorch.export.Dim(name, min, max)
API ?
Ultimately, the ask here is for the graph (provided by torch.compile
to its backend) to have the range information (similar to torch.export.export()).
Please let me know if there's a way to do this currently (or) any questions you have.
Alternatives
No response
Additional context
No response
cc @ezyang @msaroufim @wconstab @bdhirsh @anijain2305 @zou3519 @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4