This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new 0932956f [CI] Enable Windows ARM64 wheels (#691)
0932956f is described below

commit 0932956fbd5595125e51606698c1bf9864e39541
Author: vortex-captain <[email protected]>
AuthorDate: Mon Oct 12 20:16:41 2026 +0800

    [CI] Enable Windows ARM64 wheels (#691)
    
    ## Summary
    
    - add a native Windows ARM64 job to the `tvm-ffi` wheel publishing
    matrix
    - enable the ARM64 target in cibuildwheel on Windows
    - select the MSVC developer environment from the running Python
    architecture so JIT extensions compile for ARM64 rather than x64
    - install the Windows ARM64 PyTorch nightly from NVIDIA before running
    wheel tests
    - enable prerelease resolution and bypass the upload-date cutoff for
    that target because the NVIDIA nightly index does not expose upload
    timestamps
    
    Following maintainer feedback, this PR enables and tests the core
    `tvm-ffi` Windows ARM64 wheel without changing the separate
    `torch-c-dlpack-ext` wheel workflow.
    
    ## Validation
    
    - Windows ARM64 publish job: 465/465 C++ tests passed
    - CPython 3.12 ARM64: 2414 passed, 44 skipped, 3 xfailed
    - CPython 3.13 ARM64: 2416 passed, 42 skipped, 3 xfailed
    - CPython 3.14t ARM64: 2418 passed, 40 skipped, 3 xfailed
    - Windows AMD64, Linux x86_64/ARM64, and macOS ARM64 wheel jobs passed
    - synchronized the branch with current `main`
    - installed `torch 2.15.0.dev20260904+cu134` from NVIDIA’s nightly index
    on native Windows ARM64
    - Torch tensor, DLPack, and optional-extension tests: 27 passed, 1
    skipped
    - Windows ARM64 inline C++ build test passed
    - applicable changed-file lint hooks passed
    
    ## Follow-up
    
    Replace the NVIDIA nightly override with the official PyTorch
    distribution source once stable Windows ARM64 wheels are available.
    
    ---------
    
    Co-authored-by: Chao Zhang <[email protected]>
    Co-authored-by: Charles Zhang <[email protected]>
---
 .github/workflows/publish_wheel.yml |  1 +
 pyproject.toml                      | 14 ++++++++++++--
 python/tvm_ffi/cpp/extension.py     | 13 +++++++++++--
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/publish_wheel.yml 
b/.github/workflows/publish_wheel.yml
index 804e396c..8b2085d3 100644
--- a/.github/workflows/publish_wheel.yml
+++ b/.github/workflows/publish_wheel.yml
@@ -34,6 +34,7 @@ jobs:
           - {os: ubuntu-latest, arch: x86_64, linux_image: manylinux_2_28, 
build_sdist: "true"}
           - {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux_2_28, 
build_sdist: "false"}
           - {os: windows-latest, arch: AMD64, linux_image: "", build_sdist: 
"false"}
+          - {os: windows-11-arm, arch: ARM64, linux_image: "", build_sdist: 
"false"}
           - {os: macos-14, arch: arm64, linux_image: "", build_sdist: "false"}
 
     steps:
diff --git a/pyproject.toml b/pyproject.toml
index dddadc2a..4fe77c73 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -43,7 +43,8 @@ cpp = ["ninja"]
 
 [dependency-groups]
 torch = [
-  "torch; python_version < '3.14'", # pytorch does not yet ship with 3.14t
+  # Windows ARM64 tests install PyTorch from NVIDIA's nightly index below.
+  "torch; python_version < '3.14' and (platform_system != 'Windows' or 
platform_machine != 'ARM64')",
   "setuptools",                     # setuptools is needed by torch jit for 
best perf
   "ninja",
   "numpy",
@@ -268,9 +269,18 @@ archs = ["x86_64", "arm64"]
 environment = { MACOSX_DEPLOYMENT_TARGET = "10.14" }
 
 [tool.cibuildwheel.windows]
-archs = ["AMD64"]
+archs = ["AMD64", "ARM64"]
 repair-wheel-command = "delvewheel repair --ignore-existing -w {dest_dir} -v 
{wheel}"
 
+[[tool.cibuildwheel.overrides]]
+select = "*-win_arm64"
+before-test = "uv pip install torch"
+
+[tool.cibuildwheel.overrides.environment]
+UV_INDEX = "https://pypi.nvidia.com/nvtorch_oot_nightly/";
+UV_NO_CONFIG = "1"
+UV_PRERELEASE = "allow"
+
 [tool.ty.environment]
 python-version = "3.9"
 extra-paths = ["python", "examples", "tests/python"]
diff --git a/python/tvm_ffi/cpp/extension.py b/python/tvm_ffi/cpp/extension.py
index a575b767..0bf06f07 100644
--- a/python/tvm_ffi/cpp/extension.py
+++ b/python/tvm_ffi/cpp/extension.py
@@ -22,6 +22,7 @@ import functools
 import hashlib
 import logging
 import os
+import platform
 import shutil
 import subprocess
 import sys
@@ -344,11 +345,19 @@ def _run_command_in_dev_prompt(
         if not Path(vsdevcmd_path).exists():
             raise FileNotFoundError(f"VsDevCmd.bat not found at: 
{vsdevcmd_path}")
 
+        machine = platform.machine().lower()
+        if machine in ("arm64", "aarch64"):
+            msvc_arch = "arm64"
+        elif machine in ("amd64", "x86_64"):
+            msvc_arch = "x64"
+        else:
+            raise RuntimeError(f"Unsupported Windows architecture: 
{platform.machine()}")
+
         # Use cmd.exe to run the batch file and then your command.
         # The /k flag keeps the command prompt open after the batch file runs.
         # The "&" symbol chains the commands.
-        cmd_command = '"{vsdevcmd_path}" -arch=x64 & {command}'.format(
-            vsdevcmd_path=vsdevcmd_path, command=" ".join(args)
+        cmd_command = '"{vsdevcmd_path}" -arch={arch} & {command}'.format(
+            vsdevcmd_path=vsdevcmd_path, arch=msvc_arch, command=" ".join(args)
         )
 
         # Execute the command in a new shell

Reply via email to