Skip to content
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

test future tensorrt version in windows wf #3290

Merged
merged 35 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a0b1989
add test tensorrt workflow
lanluo-nvidia Oct 28, 2024
09689ee
test
lanluo-nvidia Oct 28, 2024
3206da7
test
lanluo-nvidia Oct 28, 2024
0a64986
test
lanluo-nvidia Oct 28, 2024
a02d944
test
lanluo-nvidia Oct 28, 2024
9c0ca36
test
lanluo-nvidia Oct 28, 2024
67cbaf3
test
lanluo-nvidia Nov 1, 2024
7765146
add some test
lanluo-nvidia Nov 3, 2024
8a199aa
test
lanluo-nvidia Nov 4, 2024
546a574
test
lanluo-nvidia Nov 4, 2024
41aec8b
test
lanluo-nvidia Nov 4, 2024
a554285
test
lanluo-nvidia Nov 4, 2024
7102fa5
test
lanluo-nvidia Nov 5, 2024
0fd94e6
test
lanluo-nvidia Nov 5, 2024
6cc2faa
resolve comments
lanluo-nvidia Nov 5, 2024
e9af038
add more tests
lanluo-nvidia Nov 7, 2024
646a515
Merge branch 'main' into lluo/tensorrt_test_workflow
lanluo-nvidia Nov 8, 2024
1bf5673
merge main into the branch
lanluo-nvidia Nov 8, 2024
1f92a78
add comments
lanluo-nvidia Nov 8, 2024
f047aa1
add future tensorrt test workflow on windows
lanluo-nvidia Nov 12, 2024
80a4a7f
test
lanluo-nvidia Nov 12, 2024
78878f6
test
lanluo-nvidia Nov 12, 2024
a624610
test
lanluo-nvidia Nov 12, 2024
5b7352c
test with other windows nodes
lanluo-nvidia Nov 12, 2024
d984c90
test
lanluo-nvidia Nov 12, 2024
1928e8a
test
lanluo-nvidia Nov 12, 2024
8fc3482
change decomposition default table due to upstream torch change
lanluo-nvidia Nov 12, 2024
4ed8e28
test
lanluo-nvidia Nov 12, 2024
7e3c1fa
test
lanluo-nvidia Nov 12, 2024
229bdf1
Merge branch 'lluo/decomposition_upstream_change' into lluo/tensorrt_…
lanluo-nvidia Nov 12, 2024
bd69526
Merge branch 'lluo/tensorrt_test_workflow' into lluo/tensorrt_test_wi…
lanluo-nvidia Nov 12, 2024
dbd740b
test
lanluo-nvidia Nov 13, 2024
69649b3
Merge branch 'main' into lluo/tensorrt_test_windows_wf
lanluo-nvidia Nov 14, 2024
1fdb135
test
lanluo-nvidia Nov 14, 2024
bb9b2b6
test
lanluo-nvidia Nov 14, 2024
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
229 changes: 229 additions & 0 deletions .github/workflows/build-tensorrt-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
name: Build Torch-TensorRT wheel on Windows with Future TensorRT Versions

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
env-script:
description: "Script to setup environment variables for the build"
default: ""
type: string
wheel-build-params:
description: "Additional parameters for bdist_wheel"
default: ""
type: string
post-script:
description: "Post script to run prior to build"
default: ""
type: string
smoke-test-script:
description: "Script for Smoke Test for a specific domain"
default: ""
type: string
package-name:
description: "Name of the actual python package that is imported"
default: ""
type: string
trigger-event:
description: "Trigger Event in caller that determines whether or not to upload"
default: ""
type: string
cache-path:
description: "The path(s) on the runner to cache or restore. The path is relative to repository."
default: ""
type: string
cache-key:
description: "The key created when saving a cache and the key used to search for a cache."
default: ""
type: string
submodules:
description: "Works as stated in actions/checkout, but the default value is recursive"
required: false
type: string
default: recursive
timeout:
description: 'Timeout for the job (in minutes)'
default: 60
type: number

permissions:
id-token: write
contents: read

jobs:
build:
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 }}
UPLOAD_TO_BASE_BUCKET: ${{ matrix.upload_to_base_bucket }}
ARCH: win_amd64
TENSORRT_STRIP_PREFIX: ${{ matrix.tensorrt.strip_prefix }}
TENSORRT_VERSION: ${{ matrix.tensorrt.version }}
TENSORRT_URLS: ${{ matrix.tensorrt.urls }}
TENSORRT_SHA256: ${{ matrix.tensorrt.sha256 }}
UPLOAD_ARTIFACT_NAME: pytorch_tensorrt_${{ matrix.tensorrt.version }}_${{ matrix.python_version }}_${{ matrix.desired_cuda }}_win_amd64
name: build_tensorrt${{ matrix.tensorrt.version }}_py${{matrix.python_version}}_${{matrix.desired_cuda}}
runs-on: ${{ matrix.validation_runner }}
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: 120
steps:
- 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
- uses: ./test-infra/.github/actions/setup-ssh
name: Setup SSH
with:
github-secret: ${{ secrets.GITHUB_TOKEN }}
activate-with-label: false
instructions: "SSH with rdesktop using ssh -L 3389:localhost:3389 %%username%%@%%hostname%%"
- name: Add Conda scripts to GitHub path
run: |
echo "C:/Jenkins/Miniconda3/Scripts" >> $GITHUB_PATH
- uses: ./test-infra/.github/actions/set-channel
- name: Set PYTORCH_VERSION
if: ${{ env.CHANNEL == 'test' }}
run: |
# When building RC, set the version to be the current candidate version,
# otherwise, leave it alone so nightly will pick up the latest
echo "PYTORCH_VERSION=${{ matrix.stable_version }}" >> "${GITHUB_ENV}"
- uses: ./test-infra/.github/actions/setup-binary-builds
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
submodules: ${{ inputs.submodules }}
setup-miniconda: false
python-version: ${{ env.PYTHON_VERSION }}
cuda-version: ${{ env.CU_VERSION }}
arch: ${{ env.ARCH }}
- name: Install XPU support package
if: ${{ matrix.gpu_arch_type == 'xpu' }}
run: |
cmd //c .\\test-infra\\.github\\scripts\\install_xpu.bat
- name: Install torch dependency
run: |
source "${BUILD_ENV_FILE}"
# shellcheck disable=SC2086
${CONDA_RUN} ${PIP_INSTALL_TORCH}
- 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: Build clean
working-directory: ${{ inputs.repository }}
env:
ENV_SCRIPT: ${{ inputs.env-script }}
run: |
source "${BUILD_ENV_FILE}"
if [[ -z "${ENV_SCRIPT}" ]]; then
${CONDA_RUN} python setup.py clean
else
if [[ ! -f ${ENV_SCRIPT} ]]; then
echo "::error::Specified env-script file (${ENV_SCRIPT}) not found"
exit 1
else
${CONDA_RUN} ${ENV_SCRIPT} python setup.py clean
fi
fi
- name: Build the wheel (bdist_wheel)
working-directory: ${{ inputs.repository }}
env:
ENV_SCRIPT: ${{ inputs.env-script }}
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
run: |
source "${BUILD_ENV_FILE}"

if [[ "$CU_VERSION" == "cpu" ]]; then
# CUDA and CPU are ABI compatible on the CPU-only parts, so strip
# in this case
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
else
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')"
fi

if [[ -z "${ENV_SCRIPT}" ]]; then
${CONDA_RUN} python setup.py bdist_wheel
else
${CONDA_RUN} ${ENV_SCRIPT} python setup.py bdist_wheel ${BUILD_PARAMS}
fi
- name: Run post-script
working-directory: ${{ inputs.repository }}
env:
POST_SCRIPT: ${{ inputs.post-script }}
ENV_SCRIPT: ${{ inputs.env-script }}
if: ${{ inputs.post-script != '' }}
run: |
set -euxo pipefail
source "${BUILD_ENV_FILE}"
${CONDA_RUN} ${ENV_SCRIPT} ${POST_SCRIPT}
- name: Smoke Test
env:
ENV_SCRIPT: ${{ inputs.env-script }}
PACKAGE_NAME: ${{ inputs.package-name }}
SMOKE_TEST_SCRIPT: ${{ inputs.smoke-test-script }}
run: |
source "${BUILD_ENV_FILE}"
WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/")
echo "$WHEEL_NAME"
${CONDA_RUN} pip install "${{ inputs.repository }}/dist/$WHEEL_NAME"
if [[ ! -f "${{ inputs.repository }}"/${SMOKE_TEST_SCRIPT} ]]; then
echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} not found"
${CONDA_RUN} "${{ inputs.repository }}/${ENV_SCRIPT}" python -c "import ${PACKAGE_NAME}; print('package version is ', ${PACKAGE_NAME}.__version__)"
else
echo "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT} found"
${CONDA_RUN} "${{ inputs.repository }}/${ENV_SCRIPT}" python "${{ inputs.repository }}/${SMOKE_TEST_SCRIPT}"
fi
# NB: Only upload to GitHub after passing smoke tests
- name: Upload wheel to GitHub
continue-on-error: true
uses: actions/upload-artifact@v3
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: ${{ inputs.repository }}/dist/
- uses: ./test-infra/.github/actions/teardown-windows
if: always()
name: Teardown Windows

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
Loading