Skip to content

Commit 41aec8b

Browse files
committed
test
1 parent 546a574 commit 41aec8b

8 files changed

+146
-19
lines changed

.github/scripts/generate-tensorrt-test-matrix.py

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
"strip_prefix": "TensorRT-10.5.0.18",
3030
"sha256": "e6436f4164db4e44d727354dccf7d93755efb70d6fbfd6fa95bdfeb2e7331b24",
3131
},
32+
"10.6.0": {
33+
"urls": "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/zip/TensorRT-10.6.0.26.Windows.win10.cuda-12.6.zip",
34+
"strip_prefix": "TensorRT-10.6.0.26",
35+
"sha256": "6c6d92c108a1b3368423e8f69f08d31269830f1e4c9da43b37ba34a176797254",
36+
},
3237
},
3338
"linux": {
3439
"10.4.0": {
@@ -41,6 +46,11 @@
4146
"strip_prefix": "TensorRT-10.5.0.18",
4247
"sha256": "f404d379d639552a3e026cd5267213bd6df18a4eb899d6e47815bbdb34854958",
4348
},
49+
"10.6.0": {
50+
"urls": "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.6.0/tars/TensorRT-10.6.0.26.Linux.x86_64-gnu.cuda-12.6.tar.gz",
51+
"strip_prefix": "TensorRT-10.6.0.26",
52+
"sha256": "f404d379d639552a3e026cd5267213bd6df18a4eb899d6e47815bbdb34854958",
53+
},
4454
},
4555
}
4656

.github/workflows/build-tensorrt-linux.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ on:
7070
required: false
7171
type: boolean
7272
default: true
73-
upload-artifact:
74-
description: 'Name to give artifacts uploaded from ${inputs.repository}/dist'
75-
default: ''
76-
type: string
7773

7874
permissions:
7975
id-token: write
@@ -96,6 +92,7 @@ jobs:
9692
TENSORRT_VERSION: ${{ matrix.tensorrt.version }}
9793
TENSORRT_URLS: ${{ matrix.tensorrt.urls }}
9894
TENSORRT_SHA256: ${{ matrix.tensorrt.sha256 }}
95+
ARTIFACT_NAME: torch_tensorrt_${{ matrix.tensorrt.version }}_py${{ matrix.python_version }}_${{ matrix.desired_cuda }}
9996
name: build_tensorrt${{ matrix.tensorrt.version }}_py${{matrix.python_version}}_${{matrix.desired_cuda}}
10097
runs-on: ${{ matrix.validation_runner }}
10198
container:
@@ -217,7 +214,7 @@ jobs:
217214
continue-on-error: true
218215
uses: actions/upload-artifact@v3
219216
with:
220-
name: ${{ inputs.upload-artifact }}
217+
name: ${{ env.ARTIFACT_NAME }}
221218
path: ${{ inputs.repository }}/dist
222219

223220
concurrency:

.github/workflows/build-test-linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build and test Linux wheels
22

33
on:
4-
# pull_request:
4+
pull_request:
55
push:
66
branches:
77
- main

.github/workflows/build-test-tensorrt-linux.yml

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ jobs:
6767
package-name: ${{ matrix.package-name }}
6868
smoke-test-script: ${{ matrix.smoke-test-script }}
6969
trigger-event: ${{ github.event_name }}
70-
upload-artifact: torch_tensorrt_${{ needs.generate-tensorrt-matrix.outputs.matrix.tensorrt.version }}_py${{ needs.generate-tensorrt-matrix.outputs.matrix.python_version }}_${{ needs.generate-tensorrt-matrix.outputs.matrix.desired_cuda }}
7170

7271
tests-py-torchscript-fe:
7372
name: Test torchscript frontend [Python]

.github/workflows/build-test-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build and test Windows wheels
22

33
on:
4-
# pull_request:
4+
pull_request:
55
push:
66
branches:
77
- main

packaging/pre_build_script.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ pip install --force-reinstall --pre ${TORCH_TORCHVISION} --index-url ${INDEX_URL
2121
export TORCH_BUILD_NUMBER=$(python -c "import torch, urllib.parse as ul; print(ul.quote_plus(torch.__version__))")
2222
export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))")
2323

24-
# replace current tensorrt version to the upgraded tensorrt version
25-
current_version="10.3.0"
26-
sed -i -e "s/tensorrt-cu12==${current_version}/tensorrt-cu12==${TENSORRT_VERSION}/g" \
24+
if [[ ${TENSORRT_VERSION} != "" ]]; then
25+
# this is the upgraded TensorRT version, replace current tensorrt version to the upgrade tensorRT version in the pyproject.toml
26+
current_version=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
27+
sed -i -e "s/tensorrt-cu12==${current_version}/tensorrt-cu12==${TENSORRT_VERSION}/g" \
2728
-e "s/tensorrt-cu12-bindings==${current_version}/tensorrt-cu12-bindings==${TENSORRT_VERSION}/g" \
2829
-e "s/tensorrt-cu12-libs==${current_version}/tensorrt-cu12-libs==${TENSORRT_VERSION}/g" \
29-
pyproject.toml
30+
pyproject.toml
31+
fi
3032

3133
if [[ "${CU_VERSION::4}" < "cu12" ]]; then
3234
# replace dependencies from tensorrt-cu12-bindings/libs to tensorrt-cu11-bindings/libs
@@ -36,7 +38,11 @@ if [[ "${CU_VERSION::4}" < "cu12" ]]; then
3638
pyproject.toml
3739
fi
3840

39-
cat toolchains/ci_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel
41+
if [[ ${TENSORRT_VERSION} != "" ]]; then
42+
cat toolchains/ci_workspaces/MODULE_tensorrt.bazel.tmpl | envsubst > MODULE.bazel
43+
else
44+
cat toolchains/ci_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel
45+
fi
4046

4147
cat MODULE.bazel
4248
export CI_BUILD=1

toolchains/ci_workspaces/MODULE.bazel.tmpl

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ http_archive(
6767
http_archive(
6868
name = "tensorrt",
6969
build_file = "@//third_party/tensorrt/archive:BUILD",
70-
sha256 = "${TENSORRT_SHA256}",
71-
strip_prefix = "${TENSORRT_STRIP_PREFIX}",
70+
sha256 = "adff1cd5abe5d87013806172351e58fd024e5bf0fc61d49ef4b84cd38ed99081",
71+
strip_prefix = "TensorRT-10.3.0.26",
7272
urls = [
73-
"${TENSORRT_URLS}",
73+
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/tars/TensorRT-10.3.0.26.Linux.x86_64-gnu.cuda-12.5.tar.gz",
7474
],
7575
)
7676

7777
http_archive(
7878
name = "tensorrt_win",
7979
build_file = "@//third_party/tensorrt/archive:BUILD",
80-
sha256 = "${TENSORRT_SHA256}",
81-
strip_prefix = "${TENSORRT_STRIP_PREFIX}",
80+
sha256 = "2bb4bcb79e8c33575816d874b0512ea28c302af1c06ee6d224da71aa182f75e0",
81+
strip_prefix = "TensorRT-10.3.0.26",
8282
urls = [
83-
"${TENSORRT_URLS}",
83+
"https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.3.0/zip/TensorRT-10.3.0.26.Windows.win10.cuda-12.5.zip",
8484
],
8585
)
8686

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
module(
2+
name = "torch_tensorrt",
3+
repo_name = "org_pytorch_tensorrt",
4+
version = "${BUILD_VERSION}"
5+
)
6+
7+
bazel_dep(name = "googletest", version = "1.14.0")
8+
bazel_dep(name = "platforms", version = "0.0.10")
9+
bazel_dep(name = "rules_cc", version = "0.0.9")
10+
bazel_dep(name = "rules_python", version = "0.34.0")
11+
12+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
13+
python.toolchain(
14+
ignore_root_user_error = True,
15+
python_version = "3.11",
16+
)
17+
18+
bazel_dep(name = "rules_pkg", version = "1.0.1")
19+
git_override(
20+
module_name = "rules_pkg",
21+
commit = "17c57f4",
22+
remote = "https://github.com/narendasan/rules_pkg",
23+
)
24+
25+
local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository")
26+
27+
# External dependency for torch_tensorrt if you already have precompiled binaries.
28+
local_repository(
29+
name = "torch_tensorrt",
30+
path = "/opt/conda/lib/python3.8/site-packages/torch_tensorrt",
31+
)
32+
33+
34+
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
35+
36+
# CUDA should be installed on the system locally
37+
new_local_repository(
38+
name = "cuda",
39+
build_file = "@//third_party/cuda:BUILD",
40+
path = "${CUDA_HOME}",
41+
)
42+
43+
new_local_repository(
44+
name = "cuda_win",
45+
build_file = "@//third_party/cuda:BUILD",
46+
path = "${CUDA_HOME}",
47+
)
48+
49+
50+
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
51+
52+
#############################################################################################################
53+
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
54+
#############################################################################################################
55+
56+
http_archive(
57+
name = "libtorch",
58+
build_file = "@//third_party/libtorch:BUILD",
59+
strip_prefix = "libtorch",
60+
urls = ["https://download.pytorch.org/libtorch/${CHANNEL}/${CU_VERSION}/libtorch-cxx11-abi-shared-with-deps-latest.zip"],
61+
)
62+
63+
# Download these tarballs manually from the NVIDIA website
64+
# Either place them in the distdir directory in third_party and use the --distdir flag
65+
# or modify the urls to "file:///<PATH TO TARBALL>/<TARBALL NAME>.tar.gz
66+
67+
http_archive(
68+
name = "tensorrt",
69+
build_file = "@//third_party/tensorrt/archive:BUILD",
70+
sha256 = "${TENSORRT_SHA256}",
71+
strip_prefix = "${TENSORRT_STRIP_PREFIX}",
72+
urls = [
73+
"${TENSORRT_URLS}",
74+
],
75+
)
76+
77+
http_archive(
78+
name = "tensorrt_win",
79+
build_file = "@//third_party/tensorrt/archive:BUILD",
80+
sha256 = "${TENSORRT_SHA256}",
81+
strip_prefix = "${TENSORRT_STRIP_PREFIX}",
82+
urls = [
83+
"${TENSORRT_URLS}",
84+
],
85+
)
86+
87+
88+
####################################################################################
89+
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
90+
####################################################################################
91+
92+
# NOTE: In the case you are using just the pre-cxx11-abi path or just the cxx11 abi path
93+
# with your local libtorch, just point deps at the same path to satisfy bazel.
94+
95+
# NOTE: NVIDIA's aarch64 PyTorch (python) wheel file uses the CXX11 ABI unlike PyTorch's standard
96+
# x86_64 python distribution. If using NVIDIA's version just point to the root of the package
97+
# for both versions here and do not use --config=pre-cxx11-abi
98+
99+
new_local_repository(
100+
name = "libtorch_win",
101+
path = "${TORCH_INSTALL_PATH}",
102+
build_file = "third_party/libtorch/BUILD"
103+
)
104+
105+
new_local_repository(
106+
name = "libtorch_pre_cxx11_abi",
107+
path = "${TORCH_INSTALL_PATH}",
108+
build_file = "third_party/libtorch/BUILD"
109+
)
110+
111+
#new_local_repository(
112+
# name = "tensorrt",
113+
# path = "/usr/",
114+
# build_file = "@//third_party/tensorrt/local:BUILD"
115+
#)

0 commit comments

Comments
 (0)