Skip to content
Draft
Show file tree
Hide file tree
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
88 changes: 88 additions & 0 deletions .github/workflows/build_windows_arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Build Windows ARM64 RTX wheel

on:
workflow_call:
inputs:
runner:
description: Windows x86_64 runner with the local ARM64 PyTorch artifact
required: true
type: string
python-version:
required: true
type: string
desired-cuda:
description: cu130 or cu132
required: true
type: string
pytorch-arm64-artifact:
description: Absolute runner-local path to the Windows ARM64 PyTorch wheel or zip
required: true
type: string
tensorrt-rtx-arm64-artifact:
description: Runner-local path or URL for the Windows ARM64 TensorRT-RTX SDK zip
default: https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Windows-arm64-cuda-13.4-Release-external.zip
type: string

permissions:
contents: read

jobs:
build:
runs-on: ${{ inputs.runner }}
timeout-minutes: 120
env:
CU_VERSION: ${{ inputs.desired-cuda }}
CHANNEL: nightly
USE_TRT_RTX: "1"
PYTHON_VERSION: ${{ inputs.python-version }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: actions/checkout@v6
with:
repository: pytorch/test-infra
path: test-infra
- uses: ./test-infra/.github/actions/setup-windows
with:
cuda-version: ${{ inputs.desired-cuda }}
- uses: actions/setup-python@v6
with:
python-version: ${{ inputs.python-version }}
architecture: x64
- name: Install x64 host build dependencies
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m pip install --pre torch --index-url "https://download.pytorch.org/whl/nightly/${{ inputs.desired-cuda }}"
python -m pip install numpy packaging pyyaml setuptools wheel fmt
- name: Prepare ARM64 target sysroot
shell: pwsh
run: |
./packaging/prepare_windows_arm64_cross.ps1 `
-PyTorchArtifact '${{ inputs.pytorch-arm64-artifact }}' `
-TensorRTArtifact '${{ inputs.tensorrt-rtx-arm64-artifact }}' `
-TargetRoot '${{ runner.temp }}\torchtrt-windows-arm64' `
-CudaRoot "$env:CUDA_PATH"
- name: Prepare Torch-TensorRT dependencies
run: bash packaging/pre_build_script_windows.sh
- name: Cross-compile Windows ARM64 wheel
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64
call packaging\build_windows_arm64_cross.bat
- name: Validate Windows ARM64 wheel
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64
powershell -NoProfile -ExecutionPolicy Bypass -File packaging\validate_windows_arm64_wheel.ps1 -DistDirectory dist
- uses: actions/upload-artifact@v6
with:
name: torch-tensorrt-rtx-${{ inputs.python-version }}-${{ inputs.desired-cuda }}-win-arm64
path: dist/*-win_arm64.whl
if-no-files-found: error
- uses: ./test-infra/.github/actions/teardown-windows
if: always()
99 changes: 99 additions & 0 deletions .github/workflows/ci-windows-arm64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: CI Windows ARM64

# RTX-only build channel. Until Windows ARM64 PyTorch is published remotely,
# this is manually dispatched onto an x86_64 Windows runner that can access the
# two runner-local PyTorch artifacts. Runtime tests begin when a native ARM64
# runner is available; cross-builds perform PE/header validation only.
on:
workflow_dispatch:
inputs:
runner:
description: Windows x86_64 runner label with access to the local artifacts
required: true
type: string
python-version:
description: Target CPython version matching both ARM64 PyTorch wheels
default: "3.12"
required: true
type: string
cuda:
description: CUDA variants to build
default: both
type: choice
options: [both, cu130, cu132]
pytorch-cu130-artifact:
description: Absolute runner-local path to the cu130 Windows ARM64 PyTorch artifact
required: false
type: string
pytorch-cu132-artifact:
description: Absolute runner-local path to the cu132 Windows ARM64 PyTorch artifact
required: false
type: string
tensorrt-rtx-artifact:
description: Optional local TensorRT-RTX ARM64 zip; blank uses the NVIDIA URL
required: false
type: string

permissions:
contents: read

jobs:
validate-inputs:
runs-on: ubuntu-latest
steps:
- name: Validate selected artifacts
env:
CUDA_SELECTION: ${{ inputs.cuda }}
PYTORCH_CU130: ${{ inputs.pytorch-cu130-artifact }}
PYTORCH_CU132: ${{ inputs.pytorch-cu132-artifact }}
run: |
set -euo pipefail
if [[ "${CUDA_SELECTION}" != "cu132" && -z "${PYTORCH_CU130}" ]]; then
echo "::error::pytorch-cu130-artifact is required for ${CUDA_SELECTION}"
exit 1
fi
if [[ "${CUDA_SELECTION}" != "cu130" && -z "${PYTORCH_CU132}" ]]; then
echo "::error::pytorch-cu132-artifact is required for ${CUDA_SELECTION}"
exit 1
fi

cu130:
needs: validate-inputs
if: inputs.cuda == 'both' || inputs.cuda == 'cu130'
uses: ./.github/workflows/build_windows_arm64.yml
with:
runner: ${{ inputs.runner }}
python-version: ${{ inputs.python-version }}
desired-cuda: cu130
pytorch-arm64-artifact: ${{ inputs.pytorch-cu130-artifact }}
tensorrt-rtx-arm64-artifact: ${{ inputs.tensorrt-rtx-artifact || 'https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Windows-arm64-cuda-13.4-Release-external.zip' }}

cu132:
needs: validate-inputs
if: inputs.cuda == 'both' || inputs.cuda == 'cu132'
uses: ./.github/workflows/build_windows_arm64.yml
with:
runner: ${{ inputs.runner }}
python-version: ${{ inputs.python-version }}
desired-cuda: cu132
pytorch-arm64-artifact: ${{ inputs.pytorch-cu132-artifact }}
tensorrt-rtx-arm64-artifact: ${{ inputs.tensorrt-rtx-artifact || 'https://developer.nvidia.com/downloads/trt/rtx_sdk/secure/1.6/TensorRT-RTX-1.6.1.120-Windows-arm64-cuda-13.4-Release-external.zip' }}

gate:
needs: [validate-inputs, cu130, cu132]
if: always()
runs-on: ubuntu-latest
steps:
- name: Gate Windows ARM64 builds
env:
VALIDATE_RESULT: ${{ needs.validate-inputs.result }}
CU130_RESULT: ${{ needs.cu130.result }}
CU132_RESULT: ${{ needs.cu132.result }}
run: |
set -euo pipefail
for result in "${VALIDATE_RESULT}" "${CU130_RESULT}" "${CU132_RESULT}"; do
if [[ "${result}" == "failure" || "${result}" == "cancelled" ]]; then
exit 1
fi
done
echo "Windows ARM64 RTX cross-build gate passed."
35 changes: 26 additions & 9 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")

Expand All @@ -16,8 +16,20 @@ config_setting(
)

config_setting(
name = "rtx_win",
name = "rtx_win_x86_64",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
],
flag_values = {
"//toolchains/dep_collection:compute_libs": "rtx",
},
)

config_setting(
name = "rtx_win_arm64",
constraint_values = [
"@platforms//cpu:arm64",
"@platforms//os:windows",
],
flag_values = {
Expand Down Expand Up @@ -226,9 +238,10 @@ pkg_tar(
srcs = ["//cpp/bin/torchtrtc"] + select({
":jetpack": [],
":no_package_executorch": [],
":rtx_win": [],
":rtx_x86_64": [],
":rtx_sbsa": [],
":rtx_win_arm64": [],
":rtx_win_x86_64": [],
":rtx_x86_64": [],
":windows": [],
"//conditions:default": [
"//examples/executorch_reference_runner:example_executorch_runner",
Expand Down Expand Up @@ -270,16 +283,18 @@ pkg_tar(
] + select({
":jetpack": [],
":no_package_executorch": [],
":rtx_win": [],
":rtx_x86_64": [],
":rtx_sbsa": [],
":rtx_win_arm64": [],
":rtx_win_x86_64": [],
":rtx_x86_64": [],
":windows": [],
"//conditions:default": [
":executorch_source_package",
":include_executorch",
],
}) + select({
":rtx_win": [],
":rtx_win_arm64": [],
":rtx_win_x86_64": [],
":windows": [],
"//conditions:default": [":bin"],
}),
Expand All @@ -300,7 +315,8 @@ pkg_tar(
alias(
name = "libtorchtrt",
actual = select({
":rtx_win": ":libtorchtrt_zip",
":rtx_win_arm64": ":libtorchtrt_zip",
":rtx_win_x86_64": ":libtorchtrt_zip",
":windows": ":libtorchtrt_zip",
"//conditions:default": ":libtorchtrt_tar",
}),
Expand All @@ -326,7 +342,8 @@ pkg_tar(
alias(
name = "libtorchtrt_runtime",
actual = select({
":rtx_win": ":libtorchtrt_runtime_zip",
":rtx_win_arm64": ":libtorchtrt_runtime_zip",
":rtx_win_x86_64": ":libtorchtrt_runtime_zip",
":windows": ":libtorchtrt_runtime_zip",
"//conditions:default": ":libtorchtrt_runtime_tar",
}),
Expand Down
23 changes: 23 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ bazel_dep(name = "rules_python", version = "1.3.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")

cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension")
use_repo(cc_configure, "local_config_cc")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
ignore_root_user_error = True,
Expand Down Expand Up @@ -94,6 +97,13 @@ new_local_repository(
path = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.2/",
)

# supposedly cuda 13.4 on windows x86 preview has everything required for cross compile for windows on arm
new_local_repository(
name = "cuda_win_arm64",
build_file = "@//third_party/cuda:BUILD",
path = "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.4/",
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

####################################################################################
Expand Down Expand Up @@ -163,6 +173,10 @@ http_archive(
urls = ["https://download.pytorch.org/libtorch/nightly/cu130/libtorch-win-shared-with-deps-latest.zip"],
)

# Native Windows ARM64 builds use the Torch package installed in the active
# Python environment. Cross-builds override discovery through TORCH_PATH.
local_torch(name = "libtorch_win_arm64")

http_archive(
name = "torch_l4t",
build_file = "@//third_party/libtorch:BUILD",
Expand Down Expand Up @@ -241,3 +255,12 @@ http_archive(
"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",
],
)

http_archive(
name = "tensorrt_rtx_win_arm64",
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-arm64-cuda-13.4-Release-external.zip",
],
)
25 changes: 20 additions & 5 deletions core/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")

package(default_visibility = ["//visibility:public"])

config_setting(
Expand Down Expand Up @@ -33,8 +34,20 @@ config_setting(
)

config_setting(
name = "rtx_win",
name = "rtx_win_x86_64",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
],
flag_values = {
"//toolchains/dep_collection:compute_libs": "rtx",
},
)

config_setting(
name = "rtx_win_arm64",
constraint_values = [
"@platforms//cpu:arm64",
"@platforms//os:windows",
],
flag_values = {
Expand Down Expand Up @@ -92,15 +105,17 @@ cc_library(
"//core/util/logging",
] + select({
":jetpack": ["@tensorrt_l4t//:nvinfer"],
":rtx_win": ["@tensorrt_rtx_win//:nvinfer"],
":rtx_x86_64": ["@tensorrt_rtx//:nvinfer"],
":rtx_sbsa": ["@tensorrt_rtx_sbsa//:nvinfer"],
":rtx_win_arm64": ["@tensorrt_rtx_win_arm64//:nvinfer"],
":rtx_win_x86_64": ["@tensorrt_rtx_win//:nvinfer"],
":rtx_x86_64": ["@tensorrt_rtx//:nvinfer"],
":sbsa": ["@tensorrt_sbsa//:nvinfer"],
":windows": ["@tensorrt_win//:nvinfer"],
"//conditions:default": ["@tensorrt//:nvinfer"],
}) + select({
":jetpack": ["@torch_l4t//:libtorch"],
":rtx_win": ["@libtorch_win//:libtorch"],
":rtx_win_arm64": ["@libtorch_win_arm64//:libtorch"],
":rtx_win_x86_64": ["@libtorch_win//:libtorch"],
":use_torch_whl": ["@torch_whl//:libtorch"],
":windows": ["@libtorch_win//:libtorch"],
"//conditions:default": ["@libtorch"],
Expand All @@ -121,6 +136,6 @@ pkg_files(
srcs = [
"compiler.h",
],
visibility = ["//visibility:public"],
prefix = "include/torch_tensorrt/core/",
visibility = ["//visibility:public"],
)
Loading
Loading