Skip to content

Commit 76b93a6

Browse files
committed
fix: Upgrade main to TRT 8.6, CUDA 11.8, Torch Dev
- Upgrade versions, make required code edits for functionality and coverage for tests and CI
1 parent 697ce1a commit 76b93a6

File tree

15 files changed

+72
-66
lines changed

15 files changed

+72
-66
lines changed

.circleci/config.yml

+25-14
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ commands:
102102
sudo apt-get --purge remove "*nvidia*"
103103
104104
install-cudnn:
105-
description: "Install CUDNN 8.5.0"
105+
description: "Install CUDNN 8.8.0"
106106
parameters:
107107
os:
108108
type: string
@@ -112,10 +112,10 @@ commands:
112112
default: "x86_64"
113113
cudnn-version:
114114
type: string
115-
default: "8.5.0.96"
115+
default: "8.8.0.121"
116116
cuda-version:
117117
type: string
118-
default: "cuda11.7"
118+
default: "cuda11.8"
119119
steps:
120120
- run:
121121
name: Install CUDNN
@@ -200,7 +200,7 @@ commands:
200200
default: "cuda11.8"
201201
cudnn-version:
202202
type: string
203-
default: "8.5.0.96"
203+
default: "8.8.0.121"
204204
trt-version-short:
205205
type: string
206206
default: "8.6.0"
@@ -252,7 +252,7 @@ commands:
252252
default: "8.6.0"
253253
cudnn-version-long:
254254
type: string
255-
default: "8.5.0.96"
255+
default: "8.8.0.121"
256256
steps:
257257
- run:
258258
name: Set up python environment
@@ -269,16 +269,19 @@ commands:
269269
parameters:
270270
torch-build:
271271
type: string
272-
default: "2.1.0.dev20230421+cu118"
272+
default: "2.1.0.dev20230419+cu118"
273+
torchvision-build:
274+
type: string
275+
default: "0.16.0.dev20230419+cu118"
273276
torch-build-index:
274277
type: string
275-
default: "https://download.pytorch.org/whl/cu118"
278+
default: "https://download.pytorch.org/whl/nightly/cu118"
276279
steps:
277280
- run:
278281
name: Install Torch
279282
command: |
280283
pip3 install --upgrade pip
281-
pip3 install torch==<< parameters.torch-build >> torchvision torchaudio --extra-index-url << parameters.torch-build-index >>
284+
pip3 install torch==<< parameters.torch-build >> torchvision==<< parameters.torchvision-build >> --extra-index-url << parameters.torch-build-index >>
282285
283286
build-py:
284287
description: "Build the torch-tensorrt python release (pre-cxx11-abi)"
@@ -474,6 +477,7 @@ commands:
474477
- run: mkdir -p /tmp/artifacts
475478
- run:
476479
name: Run core / C++ tests
480+
no_output_timeout: 15m
477481
environment:
478482
LD_LIBRARY_PATH: "/opt/circleci/.pyenv/versions/3.9.4/lib/python3.9/site-packages/torch_tensorrt.libs:/home/circleci/project/bazel-project/external/libtorch_pre_cxx11_abi/lib/:/home/circleci/project/bazel-project/external/tensorrt/lib/:/usr/local/cuda-11.8/lib64/:$LD_LIBRARY_PATH"
479483
command: |
@@ -974,11 +978,15 @@ jobs:
974978
type: string
975979
trt-version-long:
976980
type: string
981+
python-version:
982+
type: string
977983
machine:
978-
image: ubuntu-2004-cuda-11.4:202110-01
984+
image: linux-cuda-11:2023.02.1
979985
resource_class: gpu.nvidia.large
980986
steps:
981987
- checkout
988+
- setup-py-version:
989+
python-version: << parameters.python-version >>
982990
- attach_workspace:
983991
at: /tmp/dist/
984992
- install-torch-from-index:
@@ -1294,19 +1302,19 @@ parameters:
12941302
# Nightly platform config
12951303
torch-build:
12961304
type: string
1297-
default: "2.1.0.dev20230421+cu118"
1305+
default: "2.1.0.dev20230419+cu118"
12981306
torch-build-index:
12991307
type: string
1300-
default: "https://download.pytorch.org/whl/cu118"
1308+
default: "https://download.pytorch.org/whl/nightly/cu118"
13011309
torch-build-legacy:
13021310
type: string
1303-
default: "1.13.1+cu118"
1311+
default: "1.13.1+cu117"
13041312
torch-build-index-legacy:
13051313
type: string
1306-
default: "https://download.pytorch.org/whl/cu118"
1314+
default: "https://download.pytorch.org/whl/cu117"
13071315
cudnn-version:
13081316
type: string
1309-
default: "8.5.0.96"
1317+
default: "8.8.0.121"
13101318
trt-version-short:
13111319
type: string
13121320
default: "8.6.0"
@@ -1392,6 +1400,7 @@ workflows:
13921400
torch-build: << pipeline.parameters.torch-build >>
13931401
torch-build-index: << pipeline.parameters.torch-build-index >>
13941402
trt-version-long: << pipeline.parameters.trt-version-long >>
1403+
python-version: << pipeline.parameters.python-version >>
13951404
requires:
13961405
- build-x86_64-linux
13971406

@@ -1473,6 +1482,7 @@ workflows:
14731482
torch-build: << pipeline.parameters.torch-build >>
14741483
torch-build-index: << pipeline.parameters.torch-build-index >>
14751484
trt-version-long: << pipeline.parameters.trt-version-long >>
1485+
python-version: << pipeline.parameters.python-version >>
14761486
requires:
14771487
- package-x86_64-linux
14781488

@@ -1513,6 +1523,7 @@ workflows:
15131523
torch-build: << pipeline.parameters.torch-build >>
15141524
torch-build-index: << pipeline.parameters.torch-build-index >>
15151525
trt-version-long: << pipeline.parameters.trt-version-long >>
1526+
python-version: << pipeline.parameters.python-version >>
15161527
requires:
15171528
- build-x86_64-linux
15181529

README.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ In the case of building on top of a custom base container, you first must determ
3131
version of the PyTorch C++ ABI. If your source of PyTorch is pytorch.org, likely this is the pre-cxx11-abi in which case you must modify `//docker/dist-build.sh` to not build the
3232
C++11 ABI version of Torch-TensorRT.
3333

34-
You can then build the container using:
35-
36-
37-
```bash
38-
docker build --build-arg BASE_IMG=<IMAGE> -f docker/Dockerfile -t torch_tensorrt:latest .
39-
```
34+
You can then build the container using the build command in the [docker README](docker/README.md#instructions)
4035

4136
If you would like to build outside a docker container, please follow the section [Compiling Torch-TensorRT](#compiling-torch-tensorrt)
4237

@@ -121,10 +116,10 @@ torch.jit.save(trt_ts_module, "trt_torchscript_module.ts") # save the TRT embedd
121116
These are the following dependencies used to verify the testcases. Torch-TensorRT can work with other versions, but the tests are not guaranteed to pass.
122117

123118
- Bazel 5.2.0
124-
- Libtorch 2.1.0.dev20230314 (built with CUDA 11.7)
125-
- CUDA 11.7
126-
- cuDNN 8.5.0
127-
- TensorRT 8.5.1.7
119+
- Libtorch 2.1.0.dev20230419 (built with CUDA 11.8)
120+
- CUDA 11.8
121+
- cuDNN 8.8.0
122+
- TensorRT 8.6.0
128123

129124
## Prebuilt Binaries and Wheel files
130125

@@ -252,7 +247,7 @@ A tarball with the include files and library can then be found in bazel-bin
252247
### Running Torch-TensorRT on a JIT Graph
253248

254249
> Make sure to add LibTorch to your LD_LIBRARY_PATH <br>
255-
> `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bazel-Torch-TensorRT/external/libtorch/lib`
250+
> `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bazel-TensorRT/external/libtorch/lib`
256251
257252
``` shell
258253
bazel run //cpp/bin/torchtrtc -- $(realpath <PATH TO GRAPH>) out.ts <input-size>

WORKSPACE

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ new_local_repository(
5151
http_archive(
5252
name = "libtorch",
5353
build_file = "@//third_party/libtorch:BUILD",
54-
sha256 = "486aeb5cf498f3df8713a96a0d178660828fc579e740c39b054bef0adef6315b",
54+
sha256 = "1a526a9cd19c1015674d26921dbb94bcd2d632a6f9c431a21c43f4e24768d834",
5555
strip_prefix = "libtorch",
56-
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
56+
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
5757
)
5858

5959
http_archive(
6060
name = "libtorch_pre_cxx11_abi",
6161
build_file = "@//third_party/libtorch:BUILD",
62-
sha256 = "03b1c29a2a2e412ab6cdb957b5fd48a64aeed1b3551ee7679908c4ac177b89ab",
62+
sha256 = "60c5912a5085a6a7073b3804b10d41d6cc054693bbeb7a45e0247050c2837bac",
6363
strip_prefix = "libtorch",
64-
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
64+
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
6565
)
6666

6767
# Download these tarballs manually from the NVIDIA website
@@ -71,10 +71,10 @@ http_archive(
7171
http_archive(
7272
name = "cudnn",
7373
build_file = "@//third_party/cudnn/archive:BUILD",
74-
sha256 = "5454a6fd94f008728caae9adad993c4e85ef36302e26bce43bea7d458a5e7b6d",
75-
strip_prefix = "cudnn-linux-x86_64-8.5.0.96_cuda11-archive",
74+
sha256 = "36fff137153ef73e6ee10bfb07f4381240a86fb9fb78ce372414b528cbab2293",
75+
strip_prefix = "cudnn-linux-x86_64-8.8.0.121_cuda11-archive",
7676
urls = [
77-
"https://developer.nvidia.com/compute/cudnn/secure/8.5.0/local_installers/11.7/cudnn-linux-x86_64-8.5.0.96_cuda11-archive.tar.xz",
77+
"https://developer.download.nvidia.com/compute/cudnn/secure/8.8.0/local_installers/11.8/cudnn-linux-x86_64-8.8.0.121_cuda11-archive.tar.xz",
7878
],
7979
)
8080

cpp/include/torch_tensorrt/macros.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#define STR(x) XSTR(x)
2525

2626
#define TORCH_TENSORRT_MAJOR_VERSION 1
27-
#define TORCH_TENSORRT_MINOR_VERSION 3
27+
#define TORCH_TENSORRT_MINOR_VERSION 5
2828
#define TORCH_TENSORRT_PATCH_VERSION 0
2929
#define TORCH_TENSORRT_VERSION \
3030
STR(TORCH_TENSORRT_MAJOR_VERSION) \

docker/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base image starts with CUDA
2-
ARG BASE_IMG=nvidia/cuda:11.7.1-devel-ubuntu22.04
2+
ARG BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04
33
FROM ${BASE_IMG} as base
44

55
ARG TENSORRT_VERSION

docker/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
* The `Dockerfile` currently uses <a href="https://github.com/bazelbuild/bazelisk">Bazelisk</a> to select the Bazel version, and uses the exact library versions of Torch and CUDA listed in <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a>.
66
* The desired versions of CUDNN and TensorRT must be specified as build-args, with major, minor, and patch versions as in: `--build-arg TENSORRT_VERSION=a.b.c --build-arg CUDNN_VERSION=x.y.z`
7-
* [**Optional**] The desired base image be changed by explicitly setting a base image, as in `--build-arg BASE_IMG=nvidia/cuda:11.7.1-devel-ubuntu22.04`, though this is optional
7+
* [**Optional**] The desired base image be changed by explicitly setting a base image, as in `--build-arg BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04`, though this is optional
88
* [**Optional**] Additionally, the desired Python version can be changed by explicitly setting a version, as in `--build-arg PYTHON_VERSION=3.10`, though this is optional as well.
99

1010
* This `Dockerfile` installs `pre-cxx11-abi` versions of Pytorch and builds Torch-TRT using `pre-cxx11-abi` libtorch as well.
@@ -17,14 +17,14 @@ Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch
1717

1818
### Instructions
1919

20-
- The example below uses CUDNN 8.5.0 and TensorRT 8.5.1
20+
- The example below uses CUDNN 8.8.0 and TensorRT 8.6.0
2121
- See <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a> for a list of current default dependencies.
2222

2323
> From root of Torch-TensorRT repo
2424
2525
Build:
2626
```
27-
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.5.1 --build-arg CUDNN_VERSION=8.5.0 -f docker/Dockerfile -t torch_tensorrt:latest .
27+
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.6.0 --build-arg CUDNN_VERSION=8.8.0 -f docker/Dockerfile -t torch_tensorrt:latest .
2828
```
2929

3030
Run:

py/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ numpy
22
packaging
33
pybind11==2.6.2
44
--extra-index-url https://download.pytorch.org/whl/nightly/cu118
5-
torch==2.1.0.dev20230421+cu118
6-
torchvision==0.16.0.dev20230421+cu118
5+
torch==2.1.0.dev20230419+cu118
6+
torchvision==0.16.0.dev20230419+cu118
77
--extra-index-url https://pypi.ngc.nvidia.com
88
tensorrt==8.6.0

py/setup.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
FX_ONLY = False
3333

34+
LEGACY = False
35+
3436
RELEASE = False
3537

3638
CI_RELEASE = False
@@ -48,6 +50,10 @@ def get_git_revision_short_hash() -> str:
4850
FX_ONLY = True
4951
sys.argv.remove("--fx-only")
5052

53+
if "--legacy" in sys.argv:
54+
LEGACY = True
55+
sys.argv.remove("--legacy")
56+
5157
if "--release" not in sys.argv:
5258
__version__ = __version__ + "+" + get_git_revision_short_hash()
5359
else:
@@ -420,7 +426,7 @@ def run(self):
420426
long_description=long_description,
421427
ext_modules=ext_modules,
422428
install_requires=[
423-
"torch==2.0.0",
429+
"torch >=2.1.dev,<2.2" if not LEGACY else "torch >=1.13.0,<2.0",
424430
],
425431
setup_requires=[],
426432
cmdclass={
@@ -449,7 +455,7 @@ def run(self):
449455
"Topic :: Software Development",
450456
"Topic :: Software Development :: Libraries",
451457
],
452-
python_requires=">=3.7",
458+
python_requires=">=3.8",
453459
include_package_data=True,
454460
package_data={
455461
"torch_tensorrt": package_data_list,

py/torch_tensorrt/fx/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ FX2TRT is merged as FX module in Torch-TensorRT
88
```
99
$ conda create --name python_env python=3.8
1010
$ conda activate python_env
11-
# Recommend to install PyTorch 1.12 and later
12-
$ conda install pytorch torchvision torchtext cudatoolkit=11.3 -c pytorch-nightly
11+
# Recommend to install PyTorch 2.0 and later
12+
$ conda install pytorch torchvision torchtext cudatoolkit=11.8 -c pytorch-nightly
1313
# Install TensorRT python package
1414
$ pip3 install nvidia-pyindex
15-
$ pip3 install tensorrt==8.5.1.7
15+
$ pip3 install tensorrt==8.6.0.12
1616
$ git clone https://github.com/pytorch/TensorRT.git
1717
$ cd TensorRT/py && python setup.py install --fx-only && cd ..
18-
$ pyton -c "import torch_tensorrt.fx"
18+
$ python -c "import torch_tensorrt.fx"
1919
# Test an example by
2020
$ python py/torch_tensorrt/fx/example/lower_example.py
2121
```

py/torch_tensorrt/fx/test/passes/test_fuse_permute_linear_trt.py

-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ def forward(self, x):
5454
apply_passes=[fuse_permute_linear],
5555
)
5656

57-
# TODO: The following test has been disabled due to a bug in TRT 8.5.1.7
58-
# with self.linear2. Issue : https://github.com/pytorch/TensorRT/issues/1444
59-
@unittest.skip(
60-
reason="test_multi_fuse_permute_linear has been disabled due to a bug in TRT 8.5.1.7 https://github.com/pytorch/TensorRT/issues/1444"
61-
)
6257
def test_multi_fuse_permute_linear(self):
6358
"""
6459
Fusion when permute output is shared by multiple linears

py/versions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.4.0.dev0"
2-
__cuda_version__ = "11.7"
3-
__cudnn_version__ = "8.5"
4-
__tensorrt_version__ = "8.5"
1+
__version__ = "1.5.0.dev0"
2+
__cuda_version__ = "11.8"
3+
__cudnn_version__ = "8.8"
4+
__tensorrt_version__ = "8.6"

pyproject.toml

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ requires = [
99
"cffi",
1010
"typing_extensions",
1111
"future",
12-
"nvidia-pyindex",
13-
"nvidia-tensorrt==8.4.3.1"
12+
"tensorrt >=8.6,<8.7"
1413
]
1514

1615
# Use legacy backend to import local packages in setup.py
@@ -20,7 +19,7 @@ requires = [
2019
[tool.black]
2120
# Uncomment if pyproject.toml worked fine to ensure consistency with flake8
2221
# line-length = 120
23-
target-versions = ["py37", "py38", "py39", "py310"]
22+
target-versions = ["py38", "py39", "py310"]
2423
force-exclude = """
2524
elu_converter/setup.py
2625
"""

toolchains/ci_workspaces/WORKSPACE.x86_64.release.rhel

+4-4
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ new_local_repository(
5656
http_archive(
5757
name = "libtorch",
5858
build_file = "@//third_party/libtorch:BUILD",
59-
sha256 = "486aeb5cf498f3df8713a96a0d178660828fc579e740c39b054bef0adef6315b",
59+
sha256 = "1a526a9cd19c1015674d26921dbb94bcd2d632a6f9c431a21c43f4e24768d834",
6060
strip_prefix = "libtorch",
61-
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
61+
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-cxx11-abi-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
6262
)
6363

6464
http_archive(
6565
name = "libtorch_pre_cxx11_abi",
6666
build_file = "@//third_party/libtorch:BUILD",
67-
sha256 = "03b1c29a2a2e412ab6cdb957b5fd48a64aeed1b3551ee7679908c4ac177b89ab",
67+
sha256 = "60c5912a5085a6a7073b3804b10d41d6cc054693bbeb7a45e0247050c2837bac",
6868
strip_prefix = "libtorch",
69-
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230421%2Bcu118.zip"],
69+
urls = ["https://download.pytorch.org/libtorch/nightly/cu118/libtorch-shared-with-deps-2.1.0.dev20230419%2Bcu118.zip"],
7070
)
7171

7272
####################################################################################

0 commit comments

Comments
 (0)