5454 description : " The target to build and publish (for repos that build multiple packages)"
5555 default : " "
5656 type : string
57+ artifact-name-prefix :
58+ description : " Optional prefix added to the GitHub wheel artifact name"
59+ default : " "
60+ type : string
5761 trigger-event :
5862 description : " Trigger Event in caller that determines whether or not to upload"
5963 default : " "
117121 required : false
118122 type : boolean
119123 default : true
124+ build-executorch-runtime :
125+ description : " Build the companion torch-tensorrt-executorch-runtime wheel into dist/"
126+ required : false
127+ type : boolean
128+ default : false
120129 pip-install-torch-extra-args :
121130 # NOTE: Why does this exist?
122131 # Well setuptools / python packaging doesn't actually allow you to specify dependencies
@@ -273,6 +282,11 @@ jobs:
273282 - name : Mark TensorRT-RTX artifact
274283 if : ${{ inputs.use-rtx }}
275284 run : echo "ARTIFACT_NAME=${ARTIFACT_NAME}_rtx" >> "${GITHUB_ENV}"
285+ - name : Prefix wheel artifact
286+ if : ${{ inputs.artifact-name-prefix }}
287+ env :
288+ ARTIFACT_PREFIX : ${{ inputs.artifact-name-prefix }}
289+ run : echo "ARTIFACT_NAME=${ARTIFACT_PREFIX}-${ARTIFACT_NAME}" >> "${GITHUB_ENV}"
276290 - name : Combine Env Var and Build Env Files
277291 if : ${{ inputs.env-var-script != '' }}
278292 working-directory : ${{ inputs.repository }}
@@ -378,6 +392,41 @@ jobs:
378392 ${CONDA_RUN} python setup.py bdist_wheel ${param}
379393 fi
380394 fi
395+ # Keep the ExecuTorch runtime in the standard wheel artifact. This makes
396+ # its packaging, manylinux repair, GitHub artifact, and PyTorch-index
397+ # upload follow the exact same path as torch-tensorrt itself.
398+ - name : Build the ExecuTorch runtime wheel
399+ if : ${{ inputs.build-executorch-runtime }}
400+ working-directory : ${{ inputs.repository }}
401+ shell : bash -l {0}
402+ run : |
403+ set -euxo pipefail
404+ source "${BUILD_ENV_FILE}"
405+ # The runtime links against the just-built standard wheel. Install it
406+ # without resolving dependencies so it cannot replace the matrix's
407+ # pinned torch/TensorRT packages.
408+ ${CONDA_RUN} python -m pip install --no-deps dist/torch_tensorrt*.whl
409+ ${CONDA_RUN} python -m pip install pyyaml "executorch==1.4.1"
410+ TORCH_CUDA_ARCH_LIST="$(${CONDA_RUN} python .github/scripts/filter-executorch-cuda-arches.py "${TORCH_CUDA_ARCH_LIST:-}")"
411+ export TORCH_CUDA_ARCH_LIST
412+ echo "TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST}"
413+ # Give the companion wheel the same channel/date and CUDA local-version
414+ # suffix as torch-tensorrt, while retaining its independent base version.
415+ main_version="$(sed 's/a0$//' version.txt)"
416+ runtime_version="$(<py/torch-tensorrt-executorch-runtime/version.txt)"
417+ if [[ "${BUILD_VERSION}" != "${main_version}"* ]]; then
418+ echo "Unexpected torch-tensorrt build version: ${BUILD_VERSION}" >&2
419+ exit 1
420+ fi
421+ if [[ ${{ inputs.is-release-wheel }} == true ]]; then
422+ BUILD_VERSION="${BUILD_VERSION%+*}"
423+ elif [[ "${BUILD_VERSION}" != *"+${CU_VERSION}" ]]; then
424+ BUILD_VERSION="${BUILD_VERSION}+${CU_VERSION}"
425+ fi
426+ export TORCH_TENSORRT_EXECUTORCH_RUNTIME_VERSION="${runtime_version}${BUILD_VERSION#"${main_version}"}"
427+ echo "TORCH_TENSORRT_EXECUTORCH_RUNTIME_VERSION=${TORCH_TENSORRT_EXECUTORCH_RUNTIME_VERSION}"
428+ ${CONDA_RUN} python -m pip wheel --no-build-isolation --no-deps --wheel-dir dist \
429+ py/torch-tensorrt-executorch-runtime
381430 - name : Repair Manylinux_2_28 Wheel
382431 shell : bash -l {0}
383432 env :
@@ -402,6 +451,29 @@ jobs:
402451 with :
403452 repository : ${{ inputs.repository }}
404453 script : ${{ inputs.post-script }}
454+ - name : Inventory packaged wheels
455+ # Keep this immediately before the smoke test/upload boundary. When a
456+ # matrix row fails downstream, its log shows exactly which repaired
457+ # wheels (and package versions) were placed in the GitHub artifact.
458+ if : ${{ inputs.is-release-tarball == false }}
459+ shell : bash -l {0}
460+ working-directory : ${{ inputs.repository }}
461+ run : |
462+ set -euo pipefail
463+ shopt -s nullglob
464+ wheels=(dist/*.whl)
465+ if [[ ${#wheels[@]} -eq 0 ]]; then
466+ echo "No wheels were produced in dist/" >&2
467+ exit 1
468+ fi
469+ echo "Packaged wheels to upload:"
470+ for wheel in "${wheels[@]}"; do
471+ echo " $(basename "${wheel}") ($(stat -c%s "${wheel}") bytes)"
472+ metadata_path="$(unzip -Z1 "${wheel}" '*.dist-info/METADATA' | head -n1)"
473+ if [[ -n "${metadata_path}" ]]; then
474+ unzip -p "${wheel}" "${metadata_path}" | grep -E '^(Name|Version):' || true
475+ fi
476+ done
405477 - name : Smoke Test
406478 # Release tarball builds do not produce a wheel.
407479 if : ${{ inputs.run-smoke-test && inputs.is-release-tarball == false }}
@@ -412,8 +484,20 @@ jobs:
412484 run : |
413485 set -euxo pipefail
414486 source "${BUILD_ENV_FILE}"
415- WHEEL_NAME=$(ls "${{ inputs.repository }}/dist/")
416- echo "$WHEEL_NAME"
487+ # PACKAGE_NAME is the import package used below. The RTX
488+ # distribution intentionally has a different wheel stem while still
489+ # importing as torch_tensorrt.
490+ WHEEL_DISTRIBUTION="${PACKAGE_NAME}"
491+ if [[ "${USE_TRT_RTX}" == "true" ]]; then
492+ WHEEL_DISTRIBUTION="${PACKAGE_NAME}_rtx"
493+ fi
494+ WHEEL_PATH="$(find "${{ inputs.repository }}/dist" -maxdepth 1 -type f -name "${WHEEL_DISTRIBUTION}-*.whl" -print -quit)"
495+ if [[ -z "${WHEEL_PATH}" ]]; then
496+ echo "No wheel for distribution ${WHEEL_DISTRIBUTION} was built" >&2
497+ exit 1
498+ fi
499+ WHEEL_NAME="$(basename "${WHEEL_PATH}")"
500+ echo "${WHEEL_NAME}"
417501 if [[ ${{ inputs.architecture }} == "aarch64" ]]; then
418502 echo "Skipping smoke test for aarch64, since it is not an actual gpu runner"
419503 else
0 commit comments