Skip to content

Commit ba93377

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 2dc510b commit ba93377

File tree

14 files changed

+62
-63
lines changed

14 files changed

+62
-63
lines changed

Diff for: .circleci/config.yml

+17-13
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: |
@@ -1205,19 +1209,19 @@ parameters:
12051209
# Nightly platform config
12061210
torch-build:
12071211
type: string
1208-
default: "2.1.0.dev20230421+cu118"
1212+
default: "2.1.0.dev20230419+cu118"
12091213
torch-build-index:
12101214
type: string
1211-
default: "https://download.pytorch.org/whl/cu118"
1215+
default: "https://download.pytorch.org/whl/nightly/cu118"
12121216
torch-build-legacy:
12131217
type: string
1214-
default: "1.13.1+cu118"
1218+
default: "1.13.1+cu117"
12151219
torch-build-index-legacy:
12161220
type: string
1217-
default: "https://download.pytorch.org/whl/cu118"
1221+
default: "https://download.pytorch.org/whl/cu117"
12181222
cudnn-version:
12191223
type: string
1220-
default: "8.5.0.96"
1224+
default: "8.8.0.121"
12211225
trt-version-short:
12221226
type: string
12231227
default: "8.6.0"

Diff for: 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>

Diff for: 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

Diff for: 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

Diff for: 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:

Diff for: 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

Diff for: 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:
@@ -380,7 +386,7 @@ def run(self):
380386
long_description=long_description,
381387
ext_modules=ext_modules,
382388
install_requires=[
383-
"torch==2.0.0",
389+
"torch >=2.0.1" if not LEGACY else "torch >=1.13.0,<2.0",
384390
],
385391
setup_requires=[],
386392
cmdclass={
@@ -409,7 +415,7 @@ def run(self):
409415
"Topic :: Software Development",
410416
"Topic :: Software Development :: Libraries",
411417
],
412-
python_requires=">=3.7",
418+
python_requires=">=3.8",
413419
include_package_data=True,
414420
package_data={
415421
"torch_tensorrt": [

Diff for: 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
```

Diff for: 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

Diff for: py/versions.py

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

Diff for: 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
"""

Diff for: 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
####################################################################################

Diff for: toolchains/ci_workspaces/WORKSPACE.x86_64.release.ubuntu

+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
####################################################################################

Diff for: tools/cpp_benchmark/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This is a quick benchmarking application for Torch-TensorRT. It lets you run sup
66

77
Run with bazel:
88

9-
> Note: Make sure libtorch and TensorRT are in your LD_LIBRARY_PATH before running, if you need a location you can `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:[WORKSPACE ROOT]/bazel-Torch-TensorRT/external/libtorch/lib:[WORKSPACE ROOT]/bazel-Torch-TensorRT/external/tensorrt/lib`
9+
> Note: Make sure libtorch and TensorRT are in your LD_LIBRARY_PATH before running, if you need a location you can `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:[WORKSPACE ROOT]/bazel-TensorRT/external/libtorch/lib:[WORKSPACE ROOT]/bazel-TensorRT/external/tensorrt/lib`
1010
1111
``` sh
1212
bazel run //tools/cpp_benchmark --cxxopt="-DNDEBUG" --cxxopt="-DJIT" --cxxopt="-DTRT" -- [PATH TO JIT MODULE FILE] [INPUT SIZE (explicit batch)]

0 commit comments

Comments
 (0)