diff --git a/.github/scripts/filter-matrix.py b/.github/scripts/filter-matrix.py index 134d004808..bc9f6603e2 100644 --- a/.github/scripts/filter-matrix.py +++ b/.github/scripts/filter-matrix.py @@ -13,8 +13,10 @@ # jetpack 6.2 only officially supports python 3.10 and cu126 jetpack_python_versions: List[str] = ["3.10"] jetpack_cuda_versions: List[str] = ["cu126"] -rtx_cuda_versions: List[str] = ["cu130", "cu132"] -trt_cuda_versions: List[str] = ["cu130", "cu132"] +# CUDA 12.6 wheels are published for x86_64 only. Keep the Arm matrices on +# CUDA 13, including Windows Arm/AArch64. +x86_cuda_versions: List[str] = ["cu126", "cu130", "cu132"] +arm_cuda_versions: List[str] = ["cu130", "cu132"] # For PRs we build/test a single representative config to keep cycle time short. # Full matrix runs on main / nightly / release branches. @@ -74,12 +76,16 @@ def filter_matrix_item( return True return False else: + cuda_versions = ( + arm_cuda_versions + if item["gpu_arch_type"] in {"cuda-aarch64", "cuda-arm64"} + else x86_cuda_versions + ) if use_rtx: - if item["desired_cuda"] not in rtx_cuda_versions: - return False - else: - if item["desired_cuda"] not in trt_cuda_versions: + if item["desired_cuda"] not in cuda_versions: return False + elif item["desired_cuda"] not in cuda_versions: + return False if item["gpu_arch_type"] == "cuda-aarch64": # pytorch image:pytorch/manylinuxaarch64-builder:cuda12.8 comes with glibc2.28 # however, TensorRT requires glibc2.31 on aarch64 platform diff --git a/.github/scripts/generate-release-matrix.py b/.github/scripts/generate-release-matrix.py index 9ac59f2499..e4ee12caa7 100644 --- a/.github/scripts/generate-release-matrix.py +++ b/.github/scripts/generate-release-matrix.py @@ -5,8 +5,8 @@ import sys RELEASE_CUDA_VERSION = { - "wheel": ["cu130", "cu132"], - "tarball": ["cu130", "cu132"], + "wheel": ["cu126", "cu130", "cu132"], + "tarball": ["cu126", "cu130", "cu132"], } RELEASE_PYTHON_VERSION = { "wheel": ["3.10", "3.11", "3.12", "3.13", "3.14"], @@ -49,6 +49,13 @@ def main(args: list[str]) -> None: includes = matrix_dict["include"] filtered_includes = [] for item in includes: + # CUDA 12.6 release artifacts are available only for x86_64. This + # excludes both Linux AArch64 and Windows Arm/AArch64 matrix entries. + if item["desired_cuda"] == "cu126" and item["gpu_arch_type"] in { + "cuda-aarch64", + "cuda-arm64", + }: + continue if ( item["desired_cuda"] in cuda_versions and item["python_version"] in python_versions diff --git a/.github/workflows/release-linux-x86_64.yml b/.github/workflows/release-linux-x86_64.yml index fb7b67f0db..0be47a5b11 100644 --- a/.github/workflows/release-linux-x86_64.yml +++ b/.github/workflows/release-linux-x86_64.yml @@ -124,6 +124,27 @@ jobs: smoke-test-script: ${{ matrix.smoke-test-script }} trigger-event: ${{ github.event_name }} is-release-wheel: true + + release-executorch-runtime-wheel-artifacts: + name: Release x86_64 torch-tensorrt-executorch-runtime wheel artifacts + needs: [generate-release-wheel-matrix] + uses: ./.github/workflows/build_linux.yml + with: + repository: pytorch/tensorrt + ref: "" + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build-matrix: ${{ needs.generate-release-wheel-matrix.outputs.matrix }} + pre-script: packaging/pre_build_script.sh + package-name: torch_tensorrt_executorch_runtime + build-platform: python-build-package + build-command: >- + bash -c 'python -m pip install pyyaml "executorch==1.4.1" && python -m pip wheel --no-build-isolation --no-deps --wheel-dir dist py/torch-tensorrt-executorch-runtime' + artifact-name-prefix: torch-tensorrt-executorch-runtime + trigger-event: ${{ github.event_name }} + is-release-wheel: true + run-smoke-test: false + concurrency: group: ${{ github.workflow }}-x86_64-release-${{ github.event.pull_request.number || github.ref_name }}-${{ inputs.repository }}-${{ github.event_name == 'workflow_dispatch' }}-${{ inputs.job-name }} - cancel-in-progress: true \ No newline at end of file + cancel-in-progress: true diff --git a/.gitignore b/.gitignore index 51871e0053..dd3feb5944 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ bazel +/node_modules/ +/package.json bazel-bazel-test bazel-bin bazel-genfiles @@ -95,4 +97,4 @@ CLAUDE.md /external/ build-executorch/ py/torch-tensorrt-executorch-runtime/build/ -py/torch-tensorrt-executorch-runtime/dist/ \ No newline at end of file +py/torch-tensorrt-executorch-runtime/dist/ diff --git a/package-lock.json b/package-lock.json index 01dc757ec1..60dffcbe02 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2,5 +2,198 @@ "name": "TensorRT", "lockfileVersion": 2, "requires": true, - "packages": {} + "packages": { + "": { + "devDependencies": { + "@openai/codex": "^0.149.1" + } + }, + "node_modules/@openai/codex": { + "version": "0.149.1", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1.tgz", + "integrity": "sha512-6q5pbcpFbJbqOpkubSDBwXmktQ55aD8eUzGzBF1zASob2DjwhBKDSNGtdZKalfrNJUdTDTPDMmzCXEXs5tMBYA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "codex": "bin/codex.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@openai/codex-darwin-arm64": "npm:@openai/codex@0.149.1-darwin-arm64", + "@openai/codex-darwin-x64": "npm:@openai/codex@0.149.1-darwin-x64", + "@openai/codex-linux-arm64": "npm:@openai/codex@0.149.1-linux-arm64", + "@openai/codex-linux-x64": "npm:@openai/codex@0.149.1-linux-x64", + "@openai/codex-win32-arm64": "npm:@openai/codex@0.149.1-win32-arm64", + "@openai/codex-win32-x64": "npm:@openai/codex@0.149.1-win32-x64" + } + }, + "node_modules/@openai/codex-darwin-arm64": { + "name": "@openai/codex", + "version": "0.149.1-darwin-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-darwin-arm64.tgz", + "integrity": "sha512-6X84kTCbnTgPIJ2EdcPsrvwS0Wxsqpa+bCswGmRf4BjhcQ5nPMnBC6yCAaCMj+vrbXQHj+L6sa9FaR4QkmA1qw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-darwin-x64": { + "name": "@openai/codex", + "version": "0.149.1-darwin-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-darwin-x64.tgz", + "integrity": "sha512-MfLBQLfcElJL9tvj6y45qVHHMGSXCPnQOixuD3/Zq0g1BW/eFizkrGLdn48cFpc+l8cK+gt5nYG5pQYwVs6g4A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-linux-arm64": { + "name": "@openai/codex", + "version": "0.149.1-linux-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-linux-arm64.tgz", + "integrity": "sha512-OqxUfZ1TVvHd18zHPKK/8ZRlpk8Vy11mg5CMHaLxNWldTbwVImDKtSLWT+m8m4NM5Sz4PbjtZMrVT/RfpBW/mQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-linux-x64": { + "name": "@openai/codex", + "version": "0.149.1-linux-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-linux-x64.tgz", + "integrity": "sha512-Of5fGYgr7tAMsyj6vhXb4/RM/UoA3Zq8BLegUBDC09UNy1XTLGYP/2XD+UX8z3qh0NDwxYdCjFIWdDNijKZggQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-win32-arm64": { + "name": "@openai/codex", + "version": "0.149.1-win32-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-win32-arm64.tgz", + "integrity": "sha512-5K0DmOKGK9Bos627p8sK8ATHjovPK0sDyT6h9Cb+4v+5CW5SGw1HLgjGxoLfJ8g3cg6mtg/pRCXXo2L/j71UVA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + }, + "node_modules/@openai/codex-win32-x64": { + "name": "@openai/codex", + "version": "0.149.1-win32-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-win32-x64.tgz", + "integrity": "sha512-G3QXGAg7nyyhqOeooAMUekBCeHd8a1QByhKcVAFyzNBaI06t6Ft7nsF+1SzFS0spuIdU4YyMi5YD26ukADBQUQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16" + } + } + }, + "dependencies": { + "@openai/codex": { + "version": "0.149.1", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1.tgz", + "integrity": "sha512-6q5pbcpFbJbqOpkubSDBwXmktQ55aD8eUzGzBF1zASob2DjwhBKDSNGtdZKalfrNJUdTDTPDMmzCXEXs5tMBYA==", + "dev": true, + "requires": { + "@openai/codex-darwin-arm64": "npm:@openai/codex@0.149.1-darwin-arm64", + "@openai/codex-darwin-x64": "npm:@openai/codex@0.149.1-darwin-x64", + "@openai/codex-linux-arm64": "npm:@openai/codex@0.149.1-linux-arm64", + "@openai/codex-linux-x64": "npm:@openai/codex@0.149.1-linux-x64", + "@openai/codex-win32-arm64": "npm:@openai/codex@0.149.1-win32-arm64", + "@openai/codex-win32-x64": "npm:@openai/codex@0.149.1-win32-x64" + } + }, + "@openai/codex-darwin-arm64": { + "version": "npm:@openai/codex@0.149.1-darwin-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-darwin-arm64.tgz", + "integrity": "sha512-6X84kTCbnTgPIJ2EdcPsrvwS0Wxsqpa+bCswGmRf4BjhcQ5nPMnBC6yCAaCMj+vrbXQHj+L6sa9FaR4QkmA1qw==", + "dev": true, + "optional": true + }, + "@openai/codex-darwin-x64": { + "version": "npm:@openai/codex@0.149.1-darwin-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-darwin-x64.tgz", + "integrity": "sha512-MfLBQLfcElJL9tvj6y45qVHHMGSXCPnQOixuD3/Zq0g1BW/eFizkrGLdn48cFpc+l8cK+gt5nYG5pQYwVs6g4A==", + "dev": true, + "optional": true + }, + "@openai/codex-linux-arm64": { + "version": "npm:@openai/codex@0.149.1-linux-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-linux-arm64.tgz", + "integrity": "sha512-OqxUfZ1TVvHd18zHPKK/8ZRlpk8Vy11mg5CMHaLxNWldTbwVImDKtSLWT+m8m4NM5Sz4PbjtZMrVT/RfpBW/mQ==", + "dev": true, + "optional": true + }, + "@openai/codex-linux-x64": { + "version": "npm:@openai/codex@0.149.1-linux-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-linux-x64.tgz", + "integrity": "sha512-Of5fGYgr7tAMsyj6vhXb4/RM/UoA3Zq8BLegUBDC09UNy1XTLGYP/2XD+UX8z3qh0NDwxYdCjFIWdDNijKZggQ==", + "dev": true, + "optional": true + }, + "@openai/codex-win32-arm64": { + "version": "npm:@openai/codex@0.149.1-win32-arm64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-win32-arm64.tgz", + "integrity": "sha512-5K0DmOKGK9Bos627p8sK8ATHjovPK0sDyT6h9Cb+4v+5CW5SGw1HLgjGxoLfJ8g3cg6mtg/pRCXXo2L/j71UVA==", + "dev": true, + "optional": true + }, + "@openai/codex-win32-x64": { + "version": "npm:@openai/codex@0.149.1-win32-x64", + "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.149.1-win32-x64.tgz", + "integrity": "sha512-G3QXGAg7nyyhqOeooAMUekBCeHd8a1QByhKcVAFyzNBaI06t6Ft7nsF+1SzFS0spuIdU4YyMi5YD26ukADBQUQ==", + "dev": true, + "optional": true + } + } } diff --git a/packaging/pre_build_script.sh b/packaging/pre_build_script.sh index 2763661d80..a5e8d2379a 100755 --- a/packaging/pre_build_script.sh +++ b/packaging/pre_build_script.sh @@ -72,6 +72,23 @@ if [[ ! -d "${TORCH_INSTALL_PATH}/include/c10" ]]; then exit 1 fi +# TensorRT archives have different CUDA compatibility ceilings. CI provides +# CU_VERSION in the PyTorch wheel format (for example, cu132). +case "${CU_VERSION}" in + cu12*) + export TENSORRT_CUDA_VERSION_UPPER_BOUND="12.9" + export TENSORRT_RTX_CUDA_VERSION_UPPER_BOUND="12.9" + ;; + cu13*) + export TENSORRT_CUDA_VERSION_UPPER_BOUND="13.3" + export TENSORRT_RTX_CUDA_VERSION_UPPER_BOUND="13.4" + ;; + *) + echo "ERROR: Unsupported CUDA version '${CU_VERSION}' for TensorRT archive selection." + exit 1 + ;; +esac + cat toolchains/ci_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel if [[ ${TENSORRT_VERSION} != "" ]]; then diff --git a/packaging/pre_build_script_windows.sh b/packaging/pre_build_script_windows.sh index 01426d1480..909e4c949a 100644 --- a/packaging/pre_build_script_windows.sh +++ b/packaging/pre_build_script_windows.sh @@ -42,6 +42,23 @@ unzip fmt.zip cp -r fmt-12.0.0/include/fmt/ $TORCH_INSTALL_PATH/include/ ls -lart $TORCH_INSTALL_PATH/include/fmt/ +# TensorRT archives have different CUDA compatibility ceilings. CI provides +# CU_VERSION in the PyTorch wheel format (for example, cu132). +case "${CU_VERSION}" in + cu12*) + export TENSORRT_CUDA_VERSION_UPPER_BOUND="12.9" + export TENSORRT_RTX_CUDA_VERSION_UPPER_BOUND="12.9" + ;; + cu13*) + export TENSORRT_CUDA_VERSION_UPPER_BOUND="13.3" + export TENSORRT_RTX_CUDA_VERSION_UPPER_BOUND="13.4" + ;; + *) + echo "ERROR: Unsupported CUDA version '${CU_VERSION}' for TensorRT archive selection." + exit 1 + ;; +esac + cat toolchains/ci_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel if [[ ${TENSORRT_VERSION} != "" ]]; then diff --git a/py/torch-tensorrt-executorch-runtime/setup.py b/py/torch-tensorrt-executorch-runtime/setup.py index dc3d853556..c78ffdfb5a 100644 --- a/py/torch-tensorrt-executorch-runtime/setup.py +++ b/py/torch-tensorrt-executorch-runtime/setup.py @@ -21,7 +21,6 @@ REPO_ROOT = HERE.parents[1] BAZEL_TARGET = "//py/torch-tensorrt-executorch-runtime/native:delegate_native" BUILD_NONCE = os.getenv("TORCH_TENSORRT_EXECUTORCH_BUILD_NONCE", uuid.uuid4().hex) -TENSORRT_DISTRIBUTION = "tensorrt-cu13" CUDA_RUNTIME_DISTRIBUTION = "nvidia-cuda-runtime" @@ -50,14 +49,16 @@ def installed_version(distribution: str) -> str: ) from error -def require_cuda_13() -> None: - """Reject builds whose native dependencies do not use supported CUDA 13.""" +def tensorrt_distribution() -> str: + """Return the TensorRT distribution matching the PyTorch CUDA build.""" cuda_version = torch.version.cuda - if cuda_version is None or not cuda_version.startswith("13."): - raise RuntimeError( - "CUDA 13-enabled PyTorch is required to build this wheel " - f"(found CUDA {cuda_version or 'None'})" - ) + if cuda_version is None: + raise RuntimeError("CUDA-enabled PyTorch is required to build this wheel") + if cuda_version.startswith("12.6"): + return "tensorrt-cu12" + if cuda_version.startswith("13."): + return "tensorrt-cu13" + raise RuntimeError(f"Unsupported CUDA version: {cuda_version}") class BazelExtension(Extension): @@ -139,7 +140,7 @@ def build_extension(self, ext: Extension) -> None: shutil.copy2(source, output.parent / dependency) -require_cuda_13() +TENSORRT_DISTRIBUTION = tensorrt_distribution() executorch_version = installed_version("executorch") tensorrt_version = installed_version(TENSORRT_DISTRIBUTION) cuda_runtime_version = installed_version(CUDA_RUNTIME_DISTRIBUTION) diff --git a/tests/py/core/test_libtorchtrt_linkage.py b/tests/py/core/test_libtorchtrt_linkage.py index 292383083e..a3a9e9b92b 100644 --- a/tests/py/core/test_libtorchtrt_linkage.py +++ b/tests/py/core/test_libtorchtrt_linkage.py @@ -31,6 +31,15 @@ def setUpClass(cls) -> None: if path.name.startswith("libnvinfer_plugin.so") ] cls.trt_lib_dirs = [path.parent for path in cls.trt_plugin_paths] + cls.cuda_runtime_paths = [ + distribution.locate_file(path) + for distribution in importlib.metadata.distributions() + for path in distribution.files or [] + if path.name.startswith("libcudart.so") + ] + cls.cuda_runtime_dirs = list( + dict.fromkeys(path.parent for path in cls.cuda_runtime_paths) + ) cls.libtorchtrt = ( Path(next(iter(torchtrt_spec.submodule_search_locations))) / "lib" @@ -74,6 +83,7 @@ def test_loads_in_fresh_process_without_importing_torch(self) -> None: [ str(self.torch_lib_dir), *map(str, self.trt_lib_dirs), + *map(str, self.cuda_runtime_dirs), *filter(None, env.get("LD_LIBRARY_PATH", "").split(os.pathsep)), ] ) @@ -108,6 +118,8 @@ def test_loads_in_fresh_process_without_importing_torch(self) -> None: f"TensorRT plugin paths: {self.trt_plugin_paths}", f"Plugin paths exist: {[path.is_file() for path in self.trt_plugin_paths]}", f"TensorRT library dirs: {self.trt_lib_dirs}", + f"CUDA runtime paths: {self.cuda_runtime_paths}", + f"CUDA runtime dirs: {self.cuda_runtime_dirs}", f"Child LD_LIBRARY_PATH: {env['LD_LIBRARY_PATH']}", ] ) diff --git a/toolchains/ci_workspaces/MODULE.bazel.tmpl b/toolchains/ci_workspaces/MODULE.bazel.tmpl index 796f714375..96ba484caa 100644 --- a/toolchains/ci_workspaces/MODULE.bazel.tmpl +++ b/toolchains/ci_workspaces/MODULE.bazel.tmpl @@ -108,7 +108,7 @@ http_archive( strip_prefix = "TensorRT-11.2.1.2", type = "tar.zst", urls = [ - "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/11.2.1/tars/TensorRT-Enterprise-11.2.1.2-Linux-x86_64-cuda-13.3-Release-external.tar.zst", + "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/11.2.1/tars/TensorRT-Enterprise-11.2.1.2-Linux-x86_64-cuda-${TENSORRT_CUDA_VERSION_UPPER_BOUND}-Release-external.tar.zst", ], ) @@ -118,7 +118,7 @@ http_archive( strip_prefix = "TensorRT-RTX-1.6.1.120", type = "tar.zst", urls = [ - "https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Linux-x86_64-cuda-13.4-Release-external.tar.zst", + "https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Linux-x86_64-cuda-${TENSORRT_RTX_CUDA_VERSION_UPPER_BOUND}-Release-external.tar.zst", ], ) @@ -156,7 +156,7 @@ http_archive( build_file = "@//third_party/tensorrt/archive:BUILD", strip_prefix = "TensorRT-11.2.1.2", urls = [ - "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/11.2.1/zip/TensorRT-Enterprise-11.2.1.2-Windows-amd64-cuda-13.3-Release-external.zip", + "https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/11.2.1/zip/TensorRT-Enterprise-11.2.1.2-Windows-amd64-cuda-${TENSORRT_CUDA_VERSION_UPPER_BOUND}-Release-external.zip", ], ) @@ -165,7 +165,7 @@ http_archive( build_file = "@//third_party/tensorrt_rtx/archive:BUILD", strip_prefix = "TensorRT-RTX-1.6.1.120", urls = [ - "https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Windows-amd64-cuda-13.4-Release-external.zip", + "https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Windows-amd64-cuda-${TENSORRT_RTX_CUDA_VERSION_UPPER_BOUND}-Release-external.zip", ], )