Skip to content

Commit

Permalink
Lluo/auto release cherry pick main (#2992)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanluo-nvidia authored Jul 17, 2024
1 parent 0d4af77 commit 0c25d92
Show file tree
Hide file tree
Showing 7 changed files with 762 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/scripts/generate-release-matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env python3

import argparse
import json
import sys

RELEASE_CUDA_VERSION = {
"wheel": ["cu124"],
"tarball": ["cu124"],
}
RELEASE_PYTHON_VERSION = {
"wheel": ["3.8", "3.9", "3.10", "3.11", "3.12"],
"tarball": ["3.10"],
}

CXX11_TARBALL_CONTAINER_IMAGE = {
"cu124": "pytorch/libtorch-cxx11-builder:cuda12.4-main",
}


def main(args: list[str]) -> None:
parser = argparse.ArgumentParser()
parser.add_argument(
"--wheel_matrix",
help="wheel matrix",
type=str,
default="",
)
parser.add_argument(
"--tarball_matrix",
help="tarball matrix",
type=str,
default="",
)
options = parser.parse_args(args)
cuda_versions = []
python_versions = []

if options.tarball_matrix != "":
cuda_versions = RELEASE_CUDA_VERSION["tarball"]
python_versions = RELEASE_PYTHON_VERSION["tarball"]
matrix_dict = json.loads(options.tarball_matrix)
elif options.wheel_matrix != "":
cuda_versions = RELEASE_CUDA_VERSION["wheel"]
python_versions = RELEASE_PYTHON_VERSION["wheel"]
matrix_dict = json.loads(options.wheel_matrix)
else:
raise Exception(
"Either --wheel_matrix or --tarball_matrix needs to be provided"
)

includes = matrix_dict["include"]
filtered_includes = []
for item in includes:
if (
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"]
]
filtered_includes.append(item)
filtered_matrix_dict = {}
filtered_matrix_dict["include"] = filtered_includes
print(json.dumps(filtered_matrix_dict))


if __name__ == "__main__":
main(sys.argv[1:])
2 changes: 1 addition & 1 deletion .github/workflows/build-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:
pushd .
cd tests/py/dynamo
python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_complete_be_e2e_test_results.xml --ir torch_compile models/test_models.py
python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_dyn_models_export.xml --ir torch_compile models/test_dyn_models.py
popd
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 @@ -193,7 +193,7 @@ jobs:
pushd .
cd tests/py/dynamo
python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_complete_be_e2e_test_results.xml --ir torch_compile models/test_models.py
python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_dyn_models_export.xml --ir torch_compile models/test_dyn_models.py
popd
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Release Linux wheels and tarball artifacts

on:
push:
tags:
# NOTE: Binary build pipelines should only get triggered on release candidate builds
# Release candidate tags look like: v1.11.0-rc1
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
workflow_dispatch:

permissions:
id-token: write
contents: read
packages: write

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }}
with:
package-type: wheel
os: linux
test-infra-repository: pytorch/test-infra
test-infra-ref: main
with-rocm: false
with-cpu: false

generate-release-tarball-matrix:
needs: [generate-matrix]
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/checkout@v3
with:
repository: pytorch/tensorrt
- name: Generate release matrix
id: generate
run: |
set -eou pipefail
MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }}
MATRIX_BLOB="$(python3 .github/scripts/generate-release-matrix.py --tarball_matrix "${MATRIX_BLOB}")"
echo "${MATRIX_BLOB}"
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
release-cxx11-tarball-artifacts:
needs: [generate-release-tarball-matrix]
name: Release torch-tensorrt cxx11 tarball artifacts
strategy:
fail-fast: false
matrix:
include:
- repository: pytorch/tensorrt
package-name: torch_tensorrt
pre-script: packaging/pre_build_script.sh
env-var-script: packaging/env_vars.txt
post-script: packaging/post_build_script.sh
smoke-test-script: packaging/smoke_test_script.sh
cxx11-tarball-release: "true"
uses: ./.github/workflows/release-wheel-linux.yml
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.generate-release-tarball-matrix.outputs.matrix }}
pre-script: ${{ matrix.pre-script }}
env-var-script: ${{ matrix.env-var-script }}
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
cxx11-tarball-release: "true"

generate-release-wheel-matrix:
needs: [generate-matrix]
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/checkout@v3
with:
repository: pytorch/tensorrt
- name: Generate release matrix
id: generate
run: |
set -eou pipefail
MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }}
MATRIX_BLOB="$(python3 .github/scripts/generate-release-matrix.py --wheel_matrix "${MATRIX_BLOB}")"
echo "${MATRIX_BLOB}"
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
release-other-artifacts:
name: Release torch-tensorrt wheel and pre-cxx11 tarball artifacts
needs: [generate-release-wheel-matrix]
strategy:
fail-fast: false
matrix:
include:
- repository: pytorch/tensorrt
package-name: torch_tensorrt
pre-script: packaging/pre_build_script.sh
env-var-script: packaging/env_vars.txt
post-script: packaging/post_build_script.sh
smoke-test-script: packaging/smoke_test_script.sh
cxx11-tarball-release: "true"
uses: ./.github/workflows/release-wheel-linux.yml
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.generate-release-wheel-matrix.outputs.matrix }}
pre-script: ${{ matrix.pre-script }}
env-var-script: ${{ matrix.env-var-script }}
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
cxx11-tarball-release: "false"

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }}
cancel-in-progress: true
Loading

0 comments on commit 0c25d92

Please sign in to comment.