Skip to content

reuse the generate binary builds from test-infra #3515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
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
23 changes: 22 additions & 1 deletion .github/scripts/filter-matrix.py
Original file line number Diff line number Diff line change
@@ -2,9 +2,11 @@

import argparse
import json
import os
import sys
from typing import List

# this was introduced to avoid build for py3.13, currently we support py3.13, but keep this for future use with other python versions
disabled_python_versions: List[str] = []


@@ -17,15 +19,34 @@ def main(args: list[str]) -> None:
default="",
)

parser.add_argument(
"--limit-pr-builds",
help="Limit PR builds to single python/cuda config(py3.11/cu12.8): true or false",
type=str,
choices=["true", "false"],
default=os.getenv("LIMIT_PR_BUILDS", "false"),
)

options = parser.parse_args(args)

if options.matrix == "":
raise Exception("--matrix needs to be provided")

matrix_dict = json.loads(options.matrix)
includes = matrix_dict["include"]
filtered_includes = []
for item in includes:
if item["python_version"] not in disabled_python_versions:
if item["python_version"] in disabled_python_versions:
continue
if options.limit_pr_builds == "true":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that instead of by default not testing multiple cuda we might want to think about testing phases to catch meaningful errors early #3501

# currently if it is the pr build, it build using py3.9 with all cuda versions, we want to change to py3.11 with singlecu12.8
if item["desired_cuda"] == "cu128":
item["python_version"] = "3.11"
build_names = item["build_name"].split("-")
build_names[1] = "py3_11"
item["build_name"] = "-".join(build_names)
filtered_includes.append(item)
else:
filtered_includes.append(item)
filtered_matrix_dict = {}
filtered_matrix_dict["include"] = filtered_includes
679 changes: 0 additions & 679 deletions .github/scripts/generate_binary_build_matrix.py

This file was deleted.

6 changes: 4 additions & 2 deletions .github/workflows/build-test-linux.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ on:

jobs:
generate-matrix:
uses: ./.github/workflows/generate_binary_build_matrix.yml
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: linux
@@ -26,6 +26,8 @@ jobs:

filter-matrix:
needs: [generate-matrix]
env:
LIMIT_PR_BUILDS: ${{ github.event_name == 'pull_request' && !contains( github.event.pull_request.labels.*.name, 'ciflow/binaries/all') }}
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
runs-on: ubuntu-latest
@@ -36,7 +38,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: pytorch/tensorrt
- name: Generate release matrix
- name: Generate matrix
id: generate
run: |
set -eou pipefail
2 changes: 1 addition & 1 deletion .github/workflows/build-test-tensorrt-linux.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ permissions:

jobs:
generate-matrix:
uses: ./.github/workflows/generate_binary_build_matrix.yml
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: linux
2 changes: 1 addition & 1 deletion .github/workflows/build-test-tensorrt-windows.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ permissions:

jobs:
generate-matrix:
uses: ./.github/workflows/generate_binary_build_matrix.yml
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: windows
29 changes: 26 additions & 3 deletions .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ on:

jobs:
generate-matrix:
uses: ./.github/workflows/generate_binary_build_matrix.yml
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
os: windows
@@ -24,16 +24,39 @@ jobs:
with-rocm: false
with-cpu: false

filter-matrix:
needs: [generate-matrix]
env:
LIMIT_PR_BUILDS: ${{ github.event_name == 'pull_request' && !contains( github.event.pull_request.labels.*.name, 'ciflow/binaries/all') }}
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/checkout@v4
with:
repository: pytorch/tensorrt
- name: Generate matrix
id: generate
run: |
set -eou pipefail
MATRIX_BLOB=${{ toJSON(needs.generate-matrix.outputs.matrix) }}
MATRIX_BLOB="$(python3 .github/scripts/filter-matrix.py --matrix "${MATRIX_BLOB}")"
echo "${MATRIX_BLOB}"
echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
substitute-runner:
needs: generate-matrix
needs: filter-matrix
outputs:
matrix: ${{ steps.substitute.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Substitute runner
id: substitute
run: |
echo matrix="$(echo '${{ needs.generate-matrix.outputs.matrix }}' | sed -e 's/windows.g4dn.xlarge/windows.g5.4xlarge.nvidia.gpu/g')" >> ${GITHUB_OUTPUT}
echo matrix="$(echo '${{ needs.filter-matrix.outputs.matrix }}' | sed -e 's/windows.g4dn.xlarge/windows.g5.4xlarge.nvidia.gpu/g')" >> ${GITHUB_OUTPUT}
build:
needs: substitute-runner
112 changes: 0 additions & 112 deletions .github/workflows/generate_binary_build_matrix.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ permissions:

jobs:
generate-matrix:
uses: ./.github/workflows/generate_binary_build_matrix.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ permissions:

jobs:
generate-matrix:
uses: ./.github/workflows/generate_binary_build_matrix.yml
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