Repository: pytorch/TensorRT (language: python)

Issue:
TRT Version Upgrade Investigation
```[tasklist]
### Tasks
- [ ] https://github.com/pytorch/TensorRT/issues/2581
- [ ] https://github.com/pytorch/TensorRT/issues/2582
- [ ] https://github.com/pytorch/TensorRT/issues/2583
```



Discussion / hints:

Fix patch:
diff --git a/.github/scripts/install-torch-tensorrt.sh b/.github/scripts/install-torch-tensorrt.sh
index 2930421d5b..69a318c179 100644
--- a/.github/scripts/install-torch-tensorrt.sh
+++ b/.github/scripts/install-torch-tensorrt.sh
@@ -4,6 +4,6 @@ set -eou pipefail
 source ${BUILD_ENV_FILE}
 ${CONDA_RUN} ${PIP_INSTALL_TORCH} torchvision pyyaml
 export TRT_VERSION=$(${CONDA_RUN} python -c "import versions; versions.tensorrt_version()")
-${CONDA_RUN} python -m pip install /opt/torch-tensorrt-builds/torch_tensorrt*+${CU_VERSION}*.whl tensorrt~=${TRT_VERSION} tensorrt-bindings~=${TRT_VERSION} --extra-index-url=https://pypi.ngc.nvidia.com
+${CONDA_RUN} python -m pip install /opt/torch-tensorrt-builds/torch_tensorrt*+${CU_VERSION}*.whl tensorrt~=${TRT_VERSION} tensorrt-bindings~=${TRT_VERSION} --extra-index-url=https://pypi.nvidia.com
 
-echo -e "Running test script";
\ No newline at end of file
+echo -e "Running test script";
diff --git a/README.md b/README.md
index 875b640304..78602255f1 100644
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ These are the following dependencies used to verify the testcases. Torch-TensorR
 - Libtorch 2.3.0.dev (latest nightly) (built with CUDA 12.1)
 - CUDA 12.1
 - cuDNN 8.9.5
-- TensorRT 8.6.1
+- TensorRT 9.2.0
 
 ## Prebuilt Binaries and Wheel files
 
diff --git a/WORKSPACE b/WORKSPACE
index bbc1803296..dc1bdb50d8 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -81,10 +81,10 @@ http_archive(
 http_archive(
     name = "tensorrt",
     build_file = "@//third_party/tensorrt/archive:BUILD",
-    sha256 = "0f8157a5fc5329943b338b893591373350afa90ca81239cdadd7580cd1eba254",
-    strip_prefix = "TensorRT-8.6.1.6",
+    sha256 = "3dd505a9e0d0adf9257080b543f51d91df736dbd1f75417b9dde1a7b7a5d87f2",
+    strip_prefix = "tensorrt-9.2.0.5",
     urls = [
-        "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.1/tars/TensorRT-8.6.1.6.Linux.x86_64-gnu.cuda-12.0.tar.gz",
+        "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/9.2.0/tensorrt-9.2.0.5.linux.x86_64-gnu.cuda-12.2.tar.gz",
     ],
 )
 
diff --git a/dev_dep_versions.yml b/dev_dep_versions.yml
index 442485474c..a4cc2974f1 100644
--- a/dev_dep_versions.yml
+++ b/dev_dep_versions.yml
@@ -1,4 +1,4 @@
 __version__: "2.3.0.dev0"
 __cuda_version__: "12.1"
 __cudnn_version__: "8.9"
-__tensorrt_version__: "8.6"
+__tensorrt_version__: "9.2.0.post12.dev5"
diff --git a/docker/README.md b/docker/README.md
index 9f83f25134..0b4799a6a5 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -17,14 +17,14 @@ Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch
 
 ### Instructions
 
-- The example below uses CUDNN 8.9 and TensorRT 8.6
+- The example below uses CUDNN 8.9 and TensorRT 9.2
 - See <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a> for a list of current default dependencies.
 
 > From root of Torch-TensorRT repo
 
 Build:
 ```
-DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.6 --build-arg CUDNN_VERSION=8.9 -f docker/Dockerfile -t torch_tensorrt:latest .
+DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=9.2 --build-arg CUDNN_VERSION=8.9 -f docker/Dockerfile -t torch_tensorrt:latest .
 ```
 
 Run:
diff --git a/packaging/pre_build_script.sh b/packaging/pre_build_script.sh
index 18cd5d9fe2..51b1bcfdd7 100755
--- a/packaging/pre_build_script.sh
+++ b/packaging/pre_build_script.sh
@@ -2,15 +2,35 @@
 
 # Install dependencies
 python3 -m pip install pyyaml
-TRT_VERSION=$(python3 -c "import versions; versions.tensorrt_version()")
+CUDNN_VERSION=$(python3 -c "import versions; print(versions.__cudnn_version__.split('.')[0])")
 yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
 yum check-update
-yum install -y ninja-build gettext tensorrt-${TRT_VERSION}.*
+yum install -y ninja-build gettext libcudnn${CUDNN_VERSION} libcudnn${CUDNN_VERSION}-devel
 wget https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 \
     && mv bazelisk-linux-amd64 /usr/bin/bazel \
     && chmod +x /usr/bin/bazel
 
+wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/9.2.0/tensorrt-9.2.0.5.linux.x86_64-gnu.cuda-12.2.tar.gz
+mkdir -p /usr/tensorrt
+tar -xzvf tensorrt-9.2.0.5.linux.x86_64-gnu.cuda-12.2.tar.gz -C /usr/tensorrt --strip-components=1
+mkdir -p /usr/lib
+cp /usr/tensorrt/lib/* /usr/lib/ || :
+mkdir -p /usr/lib64
+cp /usr/tensorrt/lib/* /usr/lib64/ || :
+mkdir -p /usr/include
+cp /usr/tensorrt/include/* /usr/include/ || :
+
+mkdir -p /usr/lib/x86_64-linux-gnu
+cp /usr/tensorrt/targets/x86_64-linux-gnu/lib/* /usr/lib/x86_64-linux-gnu/ || :
+mkdir -p /usr/include/x86_64-linux-gnu
+cp /usr/tensorrt/targets/x86_64-linux-gnu/include/* /usr/include/x86_64-linux-gnu/ || :
+
+rm tensorrt-9.2.0.5.linux.x86_64-gnu.cuda-12.2.tar.gz
+rm -rf /usr/tensorrt
+
 export TORCH_BUILD_NUMBER=$(python -c "import torch, urllib.parse as ul; print(ul.quote_plus(torch.__version__))")
 
 cat toolchains/ci_workspaces/WORKSPACE.x86_64.release.rhel.tmpl | envsubst > WORKSPACE
 export CI_BUILD=1
+
+python -m pip config set global.extra-index-url "https://pypi.nvidia.com"
diff --git a/py/ci/soname_excludes.params b/py/ci/soname_excludes.params
index a5eecb7c9a..c92ceb123f 100644
--- a/py/ci/soname_excludes.params
+++ b/py/ci/soname_excludes.params
@@ -24,11 +24,13 @@
 --exclude libcudart.so.11
 --exclude libcudart.so.11.7.60
 --exclude libnvrtc.so.11.2
+--exclude libnvinfer_plugin.so.9
 --exclude libnvinfer_plugin.so.8
 --exclude libcublas.so.11
 --exclude libcuda.so.1
 --exclude libcuda.so.515
 --exclude libcublasLt.so.11
+--exclude libnvinfer.so.9
 --exclude libnvinfer.so.8
 --exclude libcudnn.so.8
 --exclude libcublas.so.12
@@ -36,4 +38,4 @@
 --exclude libcublas.so.12.1.3.1
 --exclude libcublasLt.so.12.1.3.1
 --exclude libcudart.so.11.8.89
---exclude libcudart.so.11
\ No newline at end of file
+--exclude libcudart.so.11
diff --git a/py/requirements.txt b/py/requirements.txt
index cd52d32436..e187213370 100644
--- a/py/requirements.txt
+++ b/py/requirements.txt
@@ -4,6 +4,6 @@ pybind11==2.6.2
 --extra-index-url https://download.pytorch.org/whl/nightly/cu121
 torch>=2.3.0.dev,<2.4.0
 torchvision>=0.18.0.dev,<0.19.0
---extra-index-url https://pypi.ngc.nvidia.com
-tensorrt==8.6.1
+--extra-index-url https://pypi.nvidia.com
+tensorrt==9.2.0.post12.dev5
 pyyaml
diff --git a/pyproject.toml b/pyproject.toml
index c987ac1f40..3e24c430c4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,8 +8,8 @@ requires = [
     "cffi>=1.15.1",
     "typing-extensions>=4.7.0",
     "future>=0.18.3",
-    "tensorrt>=8.6,<8.7",
     "torch >=2.3.0.dev,<2.4.0",
+    "tensorrt==9.2.0.post12.dev5",
     "pybind11==2.6.2",
     "numpy",
 ]
@@ -42,7 +42,7 @@ requires-python = ">=3.8"
 keywords = ["pytorch", "torch", "tensorrt", "trt", "ai", "artificial intelligence", "ml", "machine learning", "dl", "deep learning", "compiler", "dynamo", "torchscript", "inference"]
 dependencies = [
     "torch >=2.3.0.dev,<2.4.0",
-    "tensorrt>=8.6,<8.7",
+    "tensorrt==9.2.0.post12.dev5",
     "packaging>=23",
     "numpy",
     "typing-extensions>=4.7.0",
diff --git a/third_party/cudnn/local/BUILD b/third_party/cudnn/local/BUILD
index d83ac2ec16..ec9494f1ce 100644
--- a/third_party/cudnn/local/BUILD
+++ b/third_party/cudnn/local/BUILD
@@ -28,8 +28,8 @@ config_setting(
 
 cc_library(
     name = "cudnn_headers",
-    hdrs = ["include/cudnn.h"] + glob([
-        "include/cudnn_*.h",
+    hdrs = glob([
+        "include/cudnn*.h",
     ]),
     includes = ["include/"],
     visibility = ["//visibility:private"],
diff --git a/third_party/tensorrt/local/BUILD b/third_party/tensorrt/local/BUILD
index 9cbe98a41e..e6bcbe70c4 100644
--- a/third_party/tensorrt/local/BUILD
+++ b/third_party/tensorrt/local/BUILD
@@ -40,9 +40,7 @@ cc_library(
                 "include/aarch64-linux-gnu/NvInferPluginUtils.h",
             ],
         ),
-        ":ci_rhel_x86_64_linux": [
-            "include/NvUtils.h",
-        ] + glob(
+        ":ci_rhel_x86_64_linux": glob(
             [
                 "include/NvInfer*.h",
             ],
diff --git a/toolchains/legacy/pyproject.toml b/toolchains/legacy/pyproject.toml
index ce9e6423cb..5606eaf214 100644
--- a/toolchains/legacy/pyproject.toml
+++ b/toolchains/legacy/pyproject.toml
@@ -8,7 +8,7 @@ requires = [
     "cffi>=1.15.1",
     "typing-extensions>=4.7.0",
     "future>=0.18.3",
-    "tensorrt>=8.6,<8.7",
+    "tensorrt==9.2.0.post12.dev5",
     "torch>=1.13.0,<2.0",
     "pybind11==2.6.2",
     "numpy",
@@ -42,7 +42,7 @@ requires-python = ">=3.8"
 keywords = ["pytorch", "torch", "tensorrt", "trt", "ai", "artificial intelligence", "ml", "machine learning", "dl", "deep learning", "compiler", "dynamo", "torchscript", "inference"]
 dependencies = [
     "torch>=1.13.0,<2.0",
-    "tensorrt>=8.6,<8.7",
+    "tensorrt==9.2.0.post12.dev5",
     "packaging>=23",
     "numpy",
     "typing-extensions>=4.7.0",


Test patch:
diff --git a/tests/py/ts/models/hw_compat.ts b/tests/py/ts/models/hw_compat.ts
index ab43e5e040..63b8ec6325 100644
Binary files a/tests/py/ts/models/hw_compat.ts and b/tests/py/ts/models/hw_compat.ts differ