-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Python Runtime Windows Builds on TRT 10 (#2764)
Co-authored-by: HolyWu <holywu@gmail.com>
- Loading branch information
Showing
29 changed files
with
593 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
set -eou pipefail | ||
source "${BUILD_ENV_FILE}" | ||
|
||
# Install test index version of Torch and Torchvision | ||
${CONDA_RUN} ${PIP_INSTALL_TORCH} torchvision | ||
${CONDA_RUN} pip install pyyaml mpmath==1.3.0 | ||
|
||
# Install TRT 10 from PyPi | ||
${CONDA_RUN} pip install tensorrt==10.0.0b6 tensorrt-${CU_VERSION::4}-bindings==10.0.0b6 tensorrt-${CU_VERSION::4}-libs==10.0.0b6 --extra-index-url https://pypi.nvidia.com | ||
|
||
# Install pre-built Torch-TRT | ||
${CONDA_RUN} pip install ${RUNNER_ARTIFACT_DIR}/torch_tensorrt*.whl | ||
|
||
echo -e "Running test script"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
name: Build and test Windows wheels | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- nightly | ||
- release/* | ||
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: | ||
|
||
jobs: | ||
generate-matrix: | ||
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | ||
with: | ||
package-type: wheel | ||
os: windows | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
with-rocm: false | ||
with-cpu: false | ||
|
||
build: | ||
needs: generate-matrix | ||
permissions: | ||
id-token: write | ||
contents: read | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
pre-script: packaging/pre_build_script_windows.sh | ||
smoke-test-script: packaging/smoke_test_windows.py | ||
package-name: torch_tensorrt | ||
name: Build torch-tensorrt whl package | ||
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main | ||
with: | ||
repository: ${{ matrix.repository }} | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
smoke-test-script: ${{ matrix.smoke-test-script }} | ||
package-name: ${{ matrix.package-name }} | ||
trigger-event: ${{ github.event_name }} | ||
|
||
tests-py-dynamo-converters: | ||
name: Test dynamo converters [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
uses: ./.github/workflows/windows-test.yml | ||
with: | ||
job-name: tests-py-dynamo-converters | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: packaging/driver_upgrade.bat | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest==0.1.6 --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_converters_test_results.xml -n 10 conversion/ | ||
popd | ||
tests-py-dynamo-fe: | ||
name: Test dynamo frontend [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
uses: ./.github/workflows/windows-test.yml | ||
with: | ||
job-name: tests-py-dynamo-fe | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: packaging/driver_upgrade.bat | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest==0.1.6 --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_fe_test_results.xml --ir dynamo models/test_models_export.py | ||
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dyn_models_export.xml --ir dynamo models/test_dyn_models.py | ||
popd | ||
tests-py-torch-compile-be: | ||
name: Test torch compile backend [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
uses: ./.github/workflows/windows-test.yml | ||
with: | ||
job-name: tests-py-torch-compile-be | ||
repository: ${{ matrix.repository }} | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
pre-script: packaging/driver_upgrade.bat | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest==0.1.6 --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/ | ||
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py | ||
popd | ||
tests-py-dynamo-core: | ||
name: Test dynamo core [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
uses: ./.github/workflows/windows-test.yml | ||
with: | ||
job-name: tests-py-dynamo-core | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: packaging/driver_upgrade.bat | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest==0.1.6 --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_runtime_test_results.xml runtime/ | ||
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_partitioning_test_results.xml partitioning/ | ||
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_lowering_test_results.xml lowering/ | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
name: Test on Windows | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
repository: | ||
description: 'Repository to checkout, defaults to ""' | ||
default: "" | ||
type: string | ||
ref: | ||
description: 'Reference to checkout, defaults to "nightly"' | ||
default: "nightly" | ||
type: string | ||
test-infra-repository: | ||
description: "Test infra repository to use" | ||
default: "pytorch/test-infra" | ||
type: string | ||
test-infra-ref: | ||
description: "Test infra reference to use" | ||
default: "" | ||
type: string | ||
build-matrix: | ||
description: "Build matrix to utilize" | ||
default: "" | ||
type: string | ||
pre-script: | ||
description: "Pre script to run prior to build" | ||
default: "" | ||
type: string | ||
script: | ||
description: 'Script to utilize' | ||
default: "python setup.py bdist_wheel" | ||
type: string | ||
job-name: | ||
description: "Name for the job, which is displayed in the GitHub UI" | ||
default: "windows-job" | ||
type: string | ||
continue-on-error: | ||
description: "Prevents a job from failing when a step fails. Set to true to allow a job to pass when exec script step fails." | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(inputs.build-matrix) }} | ||
env: | ||
PYTHON_VERSION: ${{ matrix.python_version }} | ||
PACKAGE_TYPE: wheel | ||
REPOSITORY: ${{ inputs.repository }} | ||
REF: ${{ inputs.ref }} | ||
CU_VERSION: ${{ matrix.desired_cuda }} | ||
SCRIPT: ${{ inputs.script }} | ||
PYTHONUTF8: 1 | ||
name: ${{ inputs.job-name }}-${{ matrix.desired_cuda }} | ||
runs-on: windows.8xlarge.nvidia.gpu.nonephemeral | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
# If a build is taking longer than 60 minutes on these runners we need | ||
# to have a conversation | ||
timeout-minutes: 60 | ||
steps: | ||
- name: Clean workspace | ||
run: | | ||
echo "::group::Cleanup debug output" | ||
rm -rfv "${GITHUB_WORKSPACE}" | ||
mkdir -p "${GITHUB_WORKSPACE}" | ||
echo "::endgroup::" | ||
- name: Checkout repository (${{ inputs.test-infra-repository }}@${{ inputs.test-infra-ref }}) | ||
uses: actions/checkout@v3 | ||
with: | ||
# Support the use case where we need to checkout someone's fork | ||
repository: ${{ inputs.test-infra-repository }} | ||
ref: ${{ inputs.test-infra-ref }} | ||
path: test-infra | ||
- name: Setup Windows | ||
uses: ./test-infra/.github/actions/setup-windows | ||
- name: Setup SSH | ||
uses: ./test-infra/.github/actions/setup-ssh | ||
with: | ||
github-secret: ${{ github.token }} | ||
- name: Add Conda scripts to GitHub path | ||
run: | | ||
echo "C:/Jenkins/Miniconda3/Scripts" >> $GITHUB_PATH | ||
- uses: ./test-infra/.github/actions/set-channel | ||
- uses: ./test-infra/.github/actions/setup-binary-builds | ||
with: | ||
repository: ${{ inputs.repository }} | ||
ref: ${{ inputs.ref }} | ||
setup-miniconda: false | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cuda-version: ${{ env.CU_VERSION }} | ||
arch: ${{ env.ARCH }} | ||
- name: Run Pre-Script with Caching | ||
if: ${{ inputs.pre-script != '' }} | ||
uses: ./test-infra/.github/actions/run-script-with-cache | ||
with: | ||
cache-path: ${{ inputs.cache-path }} | ||
cache-key: ${{ inputs.cache-key }} | ||
repository: ${{ inputs.repository }} | ||
script: ${{ inputs.pre-script }} | ||
is_windows: 'enabled' | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ env.ARTIFACT_NAME }} | ||
path: ${{ runner.temp }}/artifacts/ | ||
- name: Pack script | ||
continue-on-error: ${{ inputs.continue-on-error }} | ||
working-directory: ${{ inputs.repository }} | ||
env: | ||
ALL_SECRETS: ${{ toJSON(secrets) }} | ||
run: | | ||
set -eou pipefail | ||
source "${BUILD_ENV_FILE}" | ||
{ | ||
echo "${SCRIPT}"; | ||
} > "user_script" | ||
cat .github/scripts/install-torch-tensorrt-windows.sh user_script > exec_script | ||
- name: Run script | ||
uses: ./test-infra/.github/actions/run-script-with-cache | ||
with: | ||
repository: ${{ inputs.repository }} | ||
script: exec_script | ||
is_windows: 'enabled' | ||
- name: Surface failing tests | ||
if: always() | ||
uses: pmeier/pytest-results-action@v0.3.0 | ||
with: | ||
path: ${{ env.RUNNER_TEST_RESULTS_DIR }} | ||
fail-on-empty: false | ||
- name: Teardown Windows | ||
if: ${{ always() }} | ||
uses: ./test-infra/.github/actions/teardown-windows | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} | ||
cancel-in-progress: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.