Skip to content

Commit 7a0d70c

Browse files
committed
cherry pick automate release PR from release/2.4 to main
1 parent c0a2bea commit 7a0d70c

7 files changed

+761
-4
lines changed
+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import json
5+
import sys
6+
7+
RELEASE_CUDA_VERSION = {
8+
"wheel": ["cu124"],
9+
"tarball": ["cu124"],
10+
}
11+
RELEASE_PYTHON_VERSION = {
12+
"wheel": ["3.8", "3.9", "3.10", "3.11", "3.12"],
13+
"tarball": ["3.10"],
14+
}
15+
16+
CXX11_TARBALL_CONTAINER_IMAGE = {
17+
"cu124": "pytorch/libtorch-cxx11-builder:cuda12.4-main",
18+
}
19+
20+
21+
def main(args: list[str]) -> None:
22+
parser = argparse.ArgumentParser()
23+
parser.add_argument(
24+
"--wheel_matrix",
25+
help="wheel matrix",
26+
type=str,
27+
default="",
28+
)
29+
parser.add_argument(
30+
"--tarball_matrix",
31+
help="tarball matrix",
32+
type=str,
33+
default="",
34+
)
35+
options = parser.parse_args(args)
36+
cuda_versions = []
37+
python_versions = []
38+
39+
if options.tarball_matrix != "":
40+
cuda_versions = RELEASE_CUDA_VERSION["tarball"]
41+
python_versions = RELEASE_PYTHON_VERSION["tarball"]
42+
matrix_dict = json.loads(options.tarball_matrix)
43+
elif options.wheel_matrix != "":
44+
cuda_versions = RELEASE_CUDA_VERSION["wheel"]
45+
python_versions = RELEASE_PYTHON_VERSION["wheel"]
46+
matrix_dict = json.loads(options.wheel_matrix)
47+
else:
48+
raise Exception(
49+
"Either --wheel_matrix or --tarball_matrix needs to be provided"
50+
)
51+
52+
includes = matrix_dict["include"]
53+
filtered_includes = []
54+
for item in includes:
55+
if (
56+
item["desired_cuda"] in cuda_versions
57+
and item["python_version"] in python_versions
58+
):
59+
if options.tarball_matrix != "":
60+
item["container_image"] = CXX11_TARBALL_CONTAINER_IMAGE[
61+
item["desired_cuda"]
62+
]
63+
filtered_includes.append(item)
64+
filtered_matrix_dict = {}
65+
filtered_matrix_dict["include"] = filtered_includes
66+
print(json.dumps(filtered_matrix_dict))
67+
68+
69+
if __name__ == "__main__":
70+
main(sys.argv[1:])

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

+2-2
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
@@ -200,7 +200,7 @@ jobs:
200200
pushd .
201201
cd tests/py/dynamo
202202
python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/
203-
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py
203+
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_complete_be_e2e_test_results.xml --ir torch_compile models/test_models.py
204204
python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_dyn_models_export.xml --ir torch_compile models/test_dyn_models.py
205205
popd
206206

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

+2-2
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
@@ -193,7 +193,7 @@ jobs:
193193
pushd .
194194
cd tests/py/dynamo
195195
python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/
196-
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py
196+
python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_complete_be_e2e_test_results.xml --ir torch_compile models/test_models.py
197197
python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_dyn_models_export.xml --ir torch_compile models/test_dyn_models.py
198198
popd
199199

.github/workflows/release-linux.yml

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Release Linux wheels and tarball artifacts
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
# NOTE: Binary build pipelines should only get triggered on release candidate builds
8+
# Release candidate tags look like: v1.11.0-rc1
9+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
10+
workflow_dispatch:
11+
12+
permissions:
13+
id-token: write
14+
contents: read
15+
packages: write
16+
17+
jobs:
18+
generate-matrix:
19+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
20+
if: ${{ contains(github.event.pull_request.labels.*.name, 'build-release-artifacts') || startsWith(github.event.ref, 'refs/tags/v') }}
21+
with:
22+
package-type: wheel
23+
os: linux
24+
test-infra-repository: pytorch/test-infra
25+
test-infra-ref: main
26+
with-rocm: false
27+
with-cpu: false
28+
29+
generate-release-tarball-matrix:
30+
needs: [generate-matrix]
31+
outputs:
32+
matrix: ${{ steps.generate.outputs.matrix }}
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/setup-python@v4
36+
with:
37+
python-version: '3.10'
38+
- uses: actions/checkout@v3
39+
with:
40+
repository: pytorch/tensorrt
41+
- name: Generate release matrix
42+
id: generate
43+
run: |
44+
set -eou pipefail
45+
MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }}
46+
MATRIX_BLOB="$(python3 .github/scripts/generate-release-matrix.py --tarball_matrix "${MATRIX_BLOB}")"
47+
echo "${MATRIX_BLOB}"
48+
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
49+
50+
release-cxx11-tarball-artifacts:
51+
needs: [generate-release-tarball-matrix]
52+
name: Release torch-tensorrt cxx11 tarball artifacts
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
include:
57+
- repository: pytorch/tensorrt
58+
package-name: torch_tensorrt
59+
pre-script: packaging/pre_build_script.sh
60+
env-var-script: packaging/env_vars.txt
61+
post-script: packaging/post_build_script.sh
62+
smoke-test-script: packaging/smoke_test_script.sh
63+
cxx11-tarball-release: "true"
64+
uses: ./.github/workflows/release-wheel-linux.yml
65+
with:
66+
repository: ${{ matrix.repository }}
67+
ref: ""
68+
test-infra-repository: pytorch/test-infra
69+
test-infra-ref: main
70+
build-matrix: ${{ needs.generate-release-tarball-matrix.outputs.matrix }}
71+
pre-script: ${{ matrix.pre-script }}
72+
env-var-script: ${{ matrix.env-var-script }}
73+
post-script: ${{ matrix.post-script }}
74+
package-name: ${{ matrix.package-name }}
75+
smoke-test-script: ${{ matrix.smoke-test-script }}
76+
trigger-event: ${{ github.event_name }}
77+
cxx11-tarball-release: "true"
78+
79+
generate-release-wheel-matrix:
80+
needs: [generate-matrix]
81+
outputs:
82+
matrix: ${{ steps.generate.outputs.matrix }}
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/setup-python@v4
86+
with:
87+
python-version: '3.10'
88+
- uses: actions/checkout@v3
89+
with:
90+
repository: pytorch/tensorrt
91+
- name: Generate release matrix
92+
id: generate
93+
run: |
94+
set -eou pipefail
95+
MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }}
96+
MATRIX_BLOB="$(python3 .github/scripts/generate-release-matrix.py --wheel_matrix "${MATRIX_BLOB}")"
97+
echo "${MATRIX_BLOB}"
98+
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
99+
100+
release-other-artifacts:
101+
name: Release torch-tensorrt wheel and pre-cxx11 tarball artifacts
102+
needs: [generate-release-wheel-matrix]
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
include:
107+
- repository: pytorch/tensorrt
108+
package-name: torch_tensorrt
109+
pre-script: packaging/pre_build_script.sh
110+
env-var-script: packaging/env_vars.txt
111+
post-script: packaging/post_build_script.sh
112+
smoke-test-script: packaging/smoke_test_script.sh
113+
cxx11-tarball-release: "true"
114+
uses: ./.github/workflows/release-wheel-linux.yml
115+
with:
116+
repository: ${{ matrix.repository }}
117+
ref: ""
118+
test-infra-repository: pytorch/test-infra
119+
test-infra-ref: main
120+
build-matrix: ${{ needs.generate-release-wheel-matrix.outputs.matrix }}
121+
pre-script: ${{ matrix.pre-script }}
122+
env-var-script: ${{ matrix.env-var-script }}
123+
post-script: ${{ matrix.post-script }}
124+
package-name: ${{ matrix.package-name }}
125+
smoke-test-script: ${{ matrix.smoke-test-script }}
126+
trigger-event: ${{ github.event_name }}
127+
cxx11-tarball-release: "false"
128+
129+
concurrency:
130+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }}
131+
cancel-in-progress: true

0 commit comments

Comments
 (0)