Skip to content

Commit 4bf66af

Browse files
Simplify Release workflow and Add windows zip in the release artifacts (#3800)
1 parent fc1781e commit 4bf66af

21 files changed

+502
-547
lines changed

.github/scripts/generate-release-matrix.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
import sys
66

77
RELEASE_CUDA_VERSION = {
8-
"wheel": ["cu128"],
9-
"tarball": ["cu128"],
8+
"wheel": ["cu129"],
9+
"tarball": ["cu129"],
1010
}
1111
RELEASE_PYTHON_VERSION = {
12-
"wheel": ["3.9", "3.10", "3.11", "3.12", "3.13"],
12+
"wheel": ["3.10", "3.11", "3.12", "3.13"],
1313
"tarball": ["3.11"],
1414
}
15+
sbsa_container_image: str = "quay.io/pypa/manylinux_2_34_aarch64"
1516

1617
CXX11_TARBALL_CONTAINER_IMAGE = {
17-
"cu128": "pytorch/libtorch-cxx11-builder:cuda12.8-main",
18+
"cu129": "pytorch/libtorch-cxx11-builder:cuda12.9-main",
1819
}
1920

2021

@@ -56,10 +57,12 @@ def main(args: list[str]) -> None:
5657
item["desired_cuda"] in cuda_versions
5758
and item["python_version"] in python_versions
5859
):
59-
if options.tarball_matrix != "":
60-
item["container_image"] = CXX11_TARBALL_CONTAINER_IMAGE[
61-
item["desired_cuda"]
62-
]
60+
if item["gpu_arch_type"] == "cuda-aarch64":
61+
item["container_image"] = sbsa_container_image
62+
# if options.tarball_matrix != "":
63+
# item["container_image"] = CXX11_TARBALL_CONTAINER_IMAGE[
64+
# item["desired_cuda"]
65+
# ]
6366
filtered_includes.append(item)
6467
filtered_matrix_dict = {}
6568
filtered_matrix_dict["include"] = filtered_includes

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
smoke-test-script: packaging/smoke_test_script.sh
6767
package-name: torch_tensorrt
6868
name: Build torch-tensorrt whl package for jetpack
69-
uses: ./.github/workflows/build_wheels_linux.yml
69+
uses: ./.github/workflows/build_linux.yml
7070
with:
7171
repository: ${{ matrix.repository }}
7272
ref: ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
smoke-test-script: packaging/smoke_test_script.sh
6464
package-name: torch_tensorrt
6565
name: Build torch-tensorrt whl package for SBSA
66-
uses: ./.github/workflows/build_wheels_linux.yml
66+
uses: ./.github/workflows/build_linux.yml
6767
with:
6868
repository: ${{ matrix.repository }}
6969
ref: ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
smoke-test-script: packaging/smoke_test_script.sh
6363
package-name: torch_tensorrt
6464
name: Build torch-tensorrt whl package for Linux x86_64
65-
uses: ./.github/workflows/build_wheels_linux.yml
65+
uses: ./.github/workflows/build_linux.yml
6666
with:
6767
repository: ${{ matrix.repository }}
6868
ref: ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
smoke-test-script: packaging/smoke_test_script.sh
6262
package-name: torch_tensorrt
6363
name: RTX - Build torch-tensorrt-rtx whl package for Linux x86_64
64-
uses: ./.github/workflows/build_wheels_linux.yml
64+
uses: ./.github/workflows/build_linux.yml
6565
with:
6666
repository: ${{ matrix.repository }}
6767
ref: ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
smoke-test-script: packaging/smoke_test_windows.py
7272
package-name: torch_tensorrt
7373
name: Build torch-tensorrt whl package for Windows
74-
uses: ./.github/workflows/build_wheels_windows.yml
74+
uses: ./.github/workflows/build_windows.yml
7575
with:
7676
repository: ${{ matrix.repository }}
7777
ref: ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
smoke-test-script: packaging/smoke_test_windows.py
7272
package-name: torch_tensorrt
7373
name: RTX - Build torch-tensorrt-rtx whl package for Windows
74-
uses: ./.github/workflows/build_wheels_windows.yml
74+
uses: ./.github/workflows/build_windows.yml
7575
with:
7676
repository: ${{ matrix.repository }}
7777
ref: ""

.github/workflows/build_wheels_linux.yml renamed to .github/workflows/build_linux.yml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ on:
117117
required: false
118118
default: false
119119
type: boolean
120+
is-release-wheel:
121+
description: Set to true if the build is for release wheel
122+
required: false
123+
default: false
124+
type: boolean
125+
is-release-tarball:
126+
description: Set to true if the build is for release tarball
127+
required: false
128+
default: false
129+
type: boolean
120130
secrets:
121131
PYPI_API_TOKEN:
122132
description: An optional token to upload to pypi
@@ -265,22 +275,42 @@ jobs:
265275
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
266276
${CONDA_RUN} python setup.py clean
267277
echo "Successfully ran `python setup.py clean`"
268-
if [[ "$BUILD_VERSION" != *"+"${CU_VERSION} ]]; then
269-
BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
278+
if [[ ${{ inputs.is-release-wheel }} == true || ${{ inputs.is-release-tarball }} == true ]]; then
279+
# release version for upload to pypi
280+
# BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121
281+
BUILD_VERSION=${BUILD_VERSION%+*}
282+
if [[ ${{ inputs.is-release-tarball }} == true ]]; then
283+
mkdir -p release/tarball
284+
TRT_VERSION=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
285+
bazel build //:libtorchtrt --compilation_mode opt --config=linux
286+
cp bazel-bin/libtorchtrt.tar.gz \
287+
release/tarball/libtorchtrt-${BUILD_VERSION}-tensorrt${TRT_VERSION}-cuda${CU_VERSION:2}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz
288+
return 0
289+
else
290+
if [[ ${{ inputs.is-release-wheel }} == true ]]; then
291+
param="--release"
292+
fi
293+
fi
294+
else
295+
# release version for upload to pytorch index
296+
if [[ "$BUILD_VERSION" != *"+"${CU_VERSION} ]]; then
297+
BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
298+
fi
270299
fi
300+
271301
echo "BUILD_VERSION=$BUILD_VERSION"
272302
echo "USE_TRT_RTX=$USE_TRT_RTX"
273303
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
274304
if [[ ${{ inputs.use-rtx }} == true ]]; then
275305
echo "Building tensorrt-rtx wheel"
276-
${CONDA_RUN} python setup.py bdist_wheel --use-rtx
306+
${CONDA_RUN} python setup.py bdist_wheel ${param} --use-rtx
277307
else
278308
if [[ ${{ inputs.is-jetpack }} == true ]]; then
279309
echo "Building tensorrt wheel for jetpack"
280-
${CONDA_RUN} python setup.py bdist_wheel --jetpack
310+
${CONDA_RUN} python setup.py bdist_wheel ${param} --jetpack
281311
else
282312
echo "Building standard tensorrt wheel"
283-
${CONDA_RUN} python setup.py bdist_wheel
313+
${CONDA_RUN} python setup.py bdist_wheel ${param}
284314
fi
285315
fi
286316
- name: Repair Manylinux_2_28 Wheel
@@ -289,7 +319,7 @@ jobs:
289319
PACKAGE_NAME: ${{ inputs.package-name }}
290320
SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }}
291321
# TODO: lan to verify whether manylinux repair is needed for jetpack
292-
#if: ${{ inputs.is-jetpack == true }}
322+
if: ${{ inputs.is-release-tarball == false }}
293323
run: |
294324
set -euxo pipefail
295325
source "${BUILD_ENV_FILE}"
@@ -312,6 +342,7 @@ jobs:
312342
env:
313343
PACKAGE_NAME: ${{ inputs.package-name }}
314344
SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }}
345+
if: ${{ inputs.is-release-tarball == false }}
315346
run: |
316347
set -euxo pipefail
317348
source "${BUILD_ENV_FILE}"
@@ -348,18 +379,27 @@ jobs:
348379
# NB: Only upload to GitHub after passing smoke tests
349380

350381
- name: Upload wheel to GitHub
382+
if: ${{ inputs.is-release-tarball == false }}
351383
continue-on-error: true
352384
uses: actions/upload-artifact@v4
353385
with:
354386
name: ${{ env.ARTIFACT_NAME }}
355387
path: ${{ inputs.repository }}/dist/
388+
- name: Upload cxx11 tarball to GitHub
389+
if: ${{ inputs.is-release-tarball == true }}
390+
continue-on-error: true
391+
uses: actions/upload-artifact@v4
392+
with:
393+
name: cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }}
394+
path: ${{ inputs.repository }}/release/tarball/
356395

357396
upload:
358397
needs: build
359398
name: upload-wheel-${{ matrix.python_version }}-${{ matrix.desired_cuda }}-${{ matrix.gpu_arch_type }}-${{ inputs.is-jetpack }}
360399
uses: pytorch/test-infra/.github/workflows/_binary_upload.yml@main
361400
# if it is not jetpack nor rtx, then upload to pytorch index
362-
if: ${{ inputs.is-jetpack == false && inputs.use-rtx == false }}
401+
# if it is the release wheel or tarball, then skip upload to pytorch index
402+
if: ${{ inputs.is-jetpack == false && inputs.use-rtx == false && inputs.is-release-wheel == false && inputs.is-release-tarball == false }}
363403
with:
364404
repository: ${{ inputs.repository }}
365405
ref: ${{ inputs.ref }}
@@ -373,5 +413,5 @@ jobs:
373413
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
374414

375415
concurrency:
376-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{inputs.use-rtx}}-${{inputs.architecture}}-${{inputs.is-jetpack}}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}
416+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{inputs.is-release-wheel}}-${{inputs.is-release-tarball}}-${{inputs.use-rtx}}-${{inputs.architecture}}-${{inputs.is-jetpack}}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}
377417
cancel-in-progress: true

.github/workflows/build_wheels_windows.yml renamed to .github/workflows/build_windows.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ on:
8989
description: 'CPU architecture to build for'
9090
default: "x64"
9191
type: string
92+
is-release-tarball:
93+
description: Set to true if the build is for release tarball
94+
required: false
95+
default: false
96+
type: boolean
97+
is-release-wheel:
98+
description: Set to true if the build is for release wheel
99+
required: false
100+
default: false
101+
type: boolean
92102

93103
permissions:
94104
id-token: write
@@ -277,6 +287,20 @@ jobs:
277287
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
278288
run: |
279289
source "${BUILD_ENV_FILE}"
290+
if [[ ${{ inputs.is-release-wheel }} == true || ${{ inputs.is-release-tarball }} == true ]]; then
291+
# release version for upload to pypi
292+
# BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121
293+
BUILD_VERSION=${BUILD_VERSION%+*}
294+
if [[ ${{ inputs.is-release-tarball }} == true ]]; then
295+
mkdir -p release/tarball
296+
TRT_VERSION=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
297+
bazel build //:libtorchtrt --compilation_mode opt --config=windows
298+
ls -lart bazel-bin/
299+
cp bazel-bin/libtorchtrt.zip\
300+
release/tarball/libtorchtrt-${BUILD_VERSION}-tensorrt${TRT_VERSION}-cuda${CU_VERSION:2}-libtorch${PYTORCH_VERSION}-x86_64-windows.zip
301+
return 0
302+
fi
303+
fi
280304
if [[ -z "${ENV_SCRIPT}" ]]; then
281305
${CONDA_RUN} python setup.py bdist_wheel
282306
else
@@ -311,7 +335,7 @@ jobs:
311335
source "${BUILD_ENV_FILE}"
312336
${CONDA_RUN} ${ENV_SCRIPT} ${POST_SCRIPT}
313337
- name: Smoke Test X64
314-
if: inputs.architecture == 'x64'
338+
if: ${{ inputs.architecture == 'x64' && inputs.is-release-tarball == false }}
315339
env:
316340
ENV_SCRIPT: ${{ inputs.env-script }}
317341
PACKAGE_NAME: ${{ inputs.package-name }}
@@ -365,11 +389,19 @@ jobs:
365389
run: |
366390
echo "ARTIFACT_NAME=${REPOSITORY//\//_}_${REF//\//_}_${PYTHON_VERSION}_${CU_VERSION}_${ARCH}" >> "${GITHUB_ENV}"
367391
- name: Upload wheel to GitHub
392+
if: ${{ inputs.is-release-tarball == false }}
368393
continue-on-error: true
369394
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
370395
with:
371396
name: ${{ env.ARTIFACT_NAME }}
372397
path: ${{ inputs.repository }}/dist/
398+
- name: Upload zip artifact to GitHub
399+
if: ${{ inputs.is-release-tarball == true }}
400+
continue-on-error: true
401+
uses: actions/upload-artifact@v4
402+
with:
403+
name: cxx11-zip-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }}
404+
path: ${{ inputs.repository }}/release/tarball/
373405
- uses: ./test-infra/.github/actions/teardown-windows
374406
if: inputs.architecture == 'x64'
375407
name: Teardown Windows
@@ -378,7 +410,8 @@ jobs:
378410
needs: build
379411
uses: pytorch/test-infra/.github/workflows/_binary_upload.yml@main
380412
# for tensorrt-rtx build, do not upload to pytorch indexat at all
381-
if: ${{ inputs.use-rtx == false }}
413+
# if it is the release wheel or tarball, then skip upload to pytorch index(release wheel are uploaded to pypi)
414+
if: ${{ inputs.use-rtx == false && inputs.is-release-wheel == false && inputs.is-release-tarball == false }}
382415
with:
383416
repository: ${{ inputs.repository }}
384417
ref: ${{ inputs.ref }}
@@ -389,5 +422,5 @@ jobs:
389422
architecture: ${{ inputs.architecture }}
390423

391424
concurrency:
392-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}
425+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ inputs.repository }}-${{ inputs.is-release-wheel }}-${{ inputs.is-release-tarball }}-${{ github.event_name == 'workflow_dispatch' }}
393426
cancel-in-progress: true

0 commit comments

Comments
 (0)