Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/scripts/generate-release-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
import sys

RELEASE_CUDA_VERSION = {
"wheel": ["cu128"],
"tarball": ["cu128"],
"wheel": ["cu129"],
"tarball": ["cu129"],
}
RELEASE_PYTHON_VERSION = {
"wheel": ["3.9", "3.10", "3.11", "3.12", "3.13"],
"wheel": ["3.10", "3.11", "3.12", "3.13"],
"tarball": ["3.11"],
}
sbsa_container_image: str = "quay.io/pypa/manylinux_2_34_aarch64"

CXX11_TARBALL_CONTAINER_IMAGE = {
"cu128": "pytorch/libtorch-cxx11-builder:cuda12.8-main",
"cu129": "pytorch/libtorch-cxx11-builder:cuda12.9-main",
}


Expand Down Expand Up @@ -56,10 +57,12 @@ def main(args: list[str]) -> None:
item["desired_cuda"] in cuda_versions
and item["python_version"] in python_versions
):
if options.tarball_matrix != "":
item["container_image"] = CXX11_TARBALL_CONTAINER_IMAGE[
item["desired_cuda"]
]
if item["gpu_arch_type"] == "cuda-aarch64":
item["container_image"] = sbsa_container_image
# if options.tarball_matrix != "":
# item["container_image"] = CXX11_TARBALL_CONTAINER_IMAGE[
# item["desired_cuda"]
# ]
filtered_includes.append(item)
filtered_matrix_dict = {}
filtered_matrix_dict["include"] = filtered_includes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux-aarch64-jetpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
smoke-test-script: packaging/smoke_test_script.sh
package-name: torch_tensorrt
name: Build torch-tensorrt whl package for jetpack
uses: ./.github/workflows/build_wheels_linux.yml
uses: ./.github/workflows/build_linux.yml
with:
repository: ${{ matrix.repository }}
ref: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
smoke-test-script: packaging/smoke_test_script.sh
package-name: torch_tensorrt
name: Build torch-tensorrt whl package for SBSA
uses: ./.github/workflows/build_wheels_linux.yml
uses: ./.github/workflows/build_linux.yml
with:
repository: ${{ matrix.repository }}
ref: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
smoke-test-script: packaging/smoke_test_script.sh
package-name: torch_tensorrt
name: Build torch-tensorrt whl package for Linux x86_64
uses: ./.github/workflows/build_wheels_linux.yml
uses: ./.github/workflows/build_linux.yml
with:
repository: ${{ matrix.repository }}
ref: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux-x86_64_rtx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
smoke-test-script: packaging/smoke_test_script.sh
package-name: torch_tensorrt
name: RTX - Build torch-tensorrt-rtx whl package for Linux x86_64
uses: ./.github/workflows/build_wheels_linux.yml
uses: ./.github/workflows/build_linux.yml
with:
repository: ${{ matrix.repository }}
ref: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
smoke-test-script: packaging/smoke_test_windows.py
package-name: torch_tensorrt
name: Build torch-tensorrt whl package for Windows
uses: ./.github/workflows/build_wheels_windows.yml
uses: ./.github/workflows/build_windows.yml
with:
repository: ${{ matrix.repository }}
ref: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-windows_rtx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
smoke-test-script: packaging/smoke_test_windows.py
package-name: torch_tensorrt
name: RTX - Build torch-tensorrt-rtx whl package for Windows
uses: ./.github/workflows/build_wheels_windows.yml
uses: ./.github/workflows/build_windows.yml
with:
repository: ${{ matrix.repository }}
ref: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ on:
required: false
default: false
type: boolean
is-release-wheel:
description: Set to true if the build is for release wheel
required: false
default: false
type: boolean
is-release-tarball:
description: Set to true if the build is for release tarball
required: false
default: false
type: boolean
secrets:
PYPI_API_TOKEN:
description: An optional token to upload to pypi
Expand Down Expand Up @@ -265,22 +275,42 @@ jobs:
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
${CONDA_RUN} python setup.py clean
echo "Successfully ran `python setup.py clean`"
if [[ "$BUILD_VERSION" != *"+"${CU_VERSION} ]]; then
BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
if [[ ${{ inputs.is-release-wheel }} == true || ${{ inputs.is-release-tarball }} == true ]]; then
# release version for upload to pypi
# BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121
BUILD_VERSION=${BUILD_VERSION%+*}
if [[ ${{ inputs.is-release-tarball }} == true ]]; then
mkdir -p release/tarball
TRT_VERSION=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
bazel build //:libtorchtrt --compilation_mode opt --config=linux
cp bazel-bin/libtorchtrt.tar.gz \
release/tarball/libtorchtrt-${BUILD_VERSION}-tensorrt${TRT_VERSION}-cuda${CU_VERSION:2}-libtorch${PYTORCH_VERSION}-x86_64-linux.tar.gz
return 0
else
if [[ ${{ inputs.is-release-wheel }} == true ]]; then
param="--release"
fi
fi
else
# release version for upload to pytorch index
if [[ "$BUILD_VERSION" != *"+"${CU_VERSION} ]]; then
BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
fi
fi

echo "BUILD_VERSION=$BUILD_VERSION"
echo "USE_TRT_RTX=$USE_TRT_RTX"
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
if [[ ${{ inputs.use-rtx }} == true ]]; then
echo "Building tensorrt-rtx wheel"
${CONDA_RUN} python setup.py bdist_wheel --use-rtx
${CONDA_RUN} python setup.py bdist_wheel ${param} --use-rtx
else
if [[ ${{ inputs.is-jetpack }} == true ]]; then
echo "Building tensorrt wheel for jetpack"
${CONDA_RUN} python setup.py bdist_wheel --jetpack
${CONDA_RUN} python setup.py bdist_wheel ${param} --jetpack
else
echo "Building standard tensorrt wheel"
${CONDA_RUN} python setup.py bdist_wheel
${CONDA_RUN} python setup.py bdist_wheel ${param}
fi
fi
- name: Repair Manylinux_2_28 Wheel
Expand All @@ -289,7 +319,7 @@ jobs:
PACKAGE_NAME: ${{ inputs.package-name }}
SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }}
# TODO: lan to verify whether manylinux repair is needed for jetpack
#if: ${{ inputs.is-jetpack == true }}
if: ${{ inputs.is-release-tarball == false }}
run: |
set -euxo pipefail
source "${BUILD_ENV_FILE}"
Expand All @@ -312,6 +342,7 @@ jobs:
env:
PACKAGE_NAME: ${{ inputs.package-name }}
SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }}
if: ${{ inputs.is-release-tarball == false }}
run: |
set -euxo pipefail
source "${BUILD_ENV_FILE}"
Expand Down Expand Up @@ -348,18 +379,27 @@ jobs:
# NB: Only upload to GitHub after passing smoke tests

- name: Upload wheel to GitHub
if: ${{ inputs.is-release-tarball == false }}
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ inputs.repository }}/dist/
- name: Upload cxx11 tarball to GitHub
if: ${{ inputs.is-release-tarball == true }}
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: cxx11-tarball-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }}
path: ${{ inputs.repository }}/release/tarball/

upload:
needs: build
name: upload-wheel-${{ matrix.python_version }}-${{ matrix.desired_cuda }}-${{ matrix.gpu_arch_type }}-${{ inputs.is-jetpack }}
uses: pytorch/test-infra/.github/workflows/_binary_upload.yml@main
# if it is not jetpack nor rtx, then upload to pytorch index
if: ${{ inputs.is-jetpack == false && inputs.use-rtx == false }}
# if it is the release wheel or tarball, then skip upload to pytorch index
if: ${{ inputs.is-jetpack == false && inputs.use-rtx == false && inputs.is-release-wheel == false && inputs.is-release-tarball == false }}
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
Expand All @@ -373,5 +413,5 @@ jobs:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

concurrency:
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' }}
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' }}
cancel-in-progress: true
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ on:
description: 'CPU architecture to build for'
default: "x64"
type: string
is-release-tarball:
description: Set to true if the build is for release tarball
required: false
default: false
type: boolean
is-release-wheel:
description: Set to true if the build is for release wheel
required: false
default: false
type: boolean

permissions:
id-token: write
Expand Down Expand Up @@ -277,6 +287,20 @@ jobs:
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
run: |
source "${BUILD_ENV_FILE}"
if [[ ${{ inputs.is-release-wheel }} == true || ${{ inputs.is-release-tarball }} == true ]]; then
# release version for upload to pypi
# BUILD_VERSION example: 2.4.0+cu121, we don't want the +cu121 part, so remove +cu121
BUILD_VERSION=${BUILD_VERSION%+*}
if [[ ${{ inputs.is-release-tarball }} == true ]]; then
mkdir -p release/tarball
TRT_VERSION=$(cat dev_dep_versions.yml | grep __tensorrt_version__ | sed 's/__tensorrt_version__: //g' | sed 's/"//g')
bazel build //:libtorchtrt --compilation_mode opt --config=windows
ls -lart bazel-bin/
cp bazel-bin/libtorchtrt.zip\
release/tarball/libtorchtrt-${BUILD_VERSION}-tensorrt${TRT_VERSION}-cuda${CU_VERSION:2}-libtorch${PYTORCH_VERSION}-x86_64-windows.zip
return 0
fi
fi
if [[ -z "${ENV_SCRIPT}" ]]; then
${CONDA_RUN} python setup.py bdist_wheel
else
Expand Down Expand Up @@ -311,7 +335,7 @@ jobs:
source "${BUILD_ENV_FILE}"
${CONDA_RUN} ${ENV_SCRIPT} ${POST_SCRIPT}
- name: Smoke Test X64
if: inputs.architecture == 'x64'
if: ${{ inputs.architecture == 'x64' && inputs.is-release-tarball == false }}
env:
ENV_SCRIPT: ${{ inputs.env-script }}
PACKAGE_NAME: ${{ inputs.package-name }}
Expand Down Expand Up @@ -365,11 +389,19 @@ jobs:
run: |
echo "ARTIFACT_NAME=${REPOSITORY//\//_}_${REF//\//_}_${PYTHON_VERSION}_${CU_VERSION}_${ARCH}" >> "${GITHUB_ENV}"
- name: Upload wheel to GitHub
if: ${{ inputs.is-release-tarball == false }}
continue-on-error: true
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ inputs.repository }}/dist/
- name: Upload zip artifact to GitHub
if: ${{ inputs.is-release-tarball == true }}
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: cxx11-zip-${{ env.PYTHON_VERSION }}-${{ env.CU_VERSION }}
path: ${{ inputs.repository }}/release/tarball/
- uses: ./test-infra/.github/actions/teardown-windows
if: inputs.architecture == 'x64'
name: Teardown Windows
Expand All @@ -378,7 +410,8 @@ jobs:
needs: build
uses: pytorch/test-infra/.github/workflows/_binary_upload.yml@main
# for tensorrt-rtx build, do not upload to pytorch indexat at all
if: ${{ inputs.use-rtx == false }}
# if it is the release wheel or tarball, then skip upload to pytorch index(release wheel are uploaded to pypi)
if: ${{ inputs.use-rtx == false && inputs.is-release-wheel == false && inputs.is-release-tarball == false }}
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
Expand All @@ -389,5 +422,5 @@ jobs:
architecture: ${{ inputs.architecture }}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}
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' }}
cancel-in-progress: true
Loading
Loading