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

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

commit cd4a6e8b0cbe2e1aa16adbab18a81319c28f29e6
Author: Tianqi Chen <[email protected]>
AuthorDate: Mon Oct 26 02:07:48 2026 +0000

    Build native Windows ARM64 ORCJIT wheels with explicit publishing
---
 .github/actions/build-orcjit-wheel/action.yml                  |  4 ++--
 .github/workflows/ci_test.yml                                  |  5 +++--
 .github/workflows/publish_orcjit_wheel.yml                     | 10 ++++++++--
 addons/tvm_ffi_orcjit/pyproject.toml                           |  2 +-
 .../src/ffi/llvm_patches/win_dll_import_generator.cc           |  8 ++++++--
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/.github/actions/build-orcjit-wheel/action.yml 
b/.github/actions/build-orcjit-wheel/action.yml
index 2009fdb4..55b93949 100644
--- a/.github/actions/build-orcjit-wheel/action.yml
+++ b/.github/actions/build-orcjit-wheel/action.yml
@@ -22,7 +22,7 @@ description: >
 
 inputs:
   arch:
-    description: "Target architecture (e.g., x86_64, aarch64, arm64, AMD64)"
+    description: "Target architecture (e.g., x86_64, aarch64, arm64, AMD64, 
ARM64)"
     required: true
   build:
     description: "cibuildwheel build selector (e.g., cp312-manylinux_x86_64)"
@@ -32,7 +32,7 @@ inputs:
     required: true
   llvm_version:
     description: "mlc-llvm-static version (keep in sync with the addon build 
requirements)"
-    default: "23.1.1"
+    default: "23.1.1.post0"
     required: false
 
 runs:
diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml
index bc3110cc..3454b022 100644
--- a/.github/workflows/ci_test.yml
+++ b/.github/workflows/ci_test.yml
@@ -59,7 +59,7 @@ jobs:
         id: orcjit_files
         run: |
           FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ 
github.base_ref }}...HEAD -- \
-            addons/tvm_ffi_orcjit/ .github/actions/build-orcjit-wheel/ | tr 
'\n' ' ')
+            addons/tvm_ffi_orcjit/ .github/actions/build-orcjit-wheel/ 
.github/workflows/publish_orcjit_wheel.yml | tr '\n' ' ')
           echo "files=$FILES" >> $GITHUB_OUTPUT
           [ -n "$FILES" ] && echo "changed=true" >> $GITHUB_OUTPUT || echo 
"changed=false" >> $GITHUB_OUTPUT
 
@@ -235,7 +235,7 @@ jobs:
     name: orcjit ${{ matrix.os }} (${{ matrix.arch }})
     runs-on: ${{ matrix.os }}
     env:
-      LLVM_VERSION: "23.1.1"
+      LLVM_VERSION: "23.1.1.post0"
     strategy:
       fail-fast: false
       matrix:
@@ -244,6 +244,7 @@ jobs:
           - {os: ubuntu-24.04-arm, arch: aarch64, build: 
"cp312-manylinux_aarch64"}
           - {os: macos-14, arch: arm64, build: "cp312-macosx_arm64"}
           - {os: windows-latest, arch: AMD64, build: "cp312-win_amd64"}
+          - {os: windows-11-arm, arch: ARM64, build: "cp312-win_arm64"}
 
     steps:
       - uses: actions/checkout@v5
diff --git a/.github/workflows/publish_orcjit_wheel.yml 
b/.github/workflows/publish_orcjit_wheel.yml
index 4d33d7f1..49da6128 100644
--- a/.github/workflows/publish_orcjit_wheel.yml
+++ b/.github/workflows/publish_orcjit_wheel.yml
@@ -21,7 +21,12 @@ on:
   workflow_dispatch:
     inputs:
       tag:
-        description: "Tag to publish (manual run)"
+        description: "Branch, tag or SHA to build"
+        required: true
+      publish:
+        description: "Publish built wheels to PyPI"
+        type: boolean
+        default: false
         required: true
 
 jobs:
@@ -36,6 +41,7 @@ jobs:
           - {os: ubuntu-24.04-arm, arch: aarch64, build: 
"cp312-manylinux_aarch64"}
           - {os: macos-14, arch: arm64, build: "cp312-macosx_arm64"}
           - {os: windows-latest, arch: AMD64, build: "cp312-win_amd64"}
+          - {os: windows-11-arm, arch: ARM64, build: "cp312-win_arm64"}
 
     steps:
       - name: Checkout repository (for local composite action)
@@ -63,7 +69,7 @@ jobs:
     permissions:
       id-token: write
       attestations: write
-    if: github.event_name == 'workflow_dispatch'
+    if: github.event_name == 'workflow_dispatch' && inputs.publish
     steps:
       - uses: actions/download-artifact@v4
         with:
diff --git a/addons/tvm_ffi_orcjit/pyproject.toml 
b/addons/tvm_ffi_orcjit/pyproject.toml
index 0f9f4c15..1ca86af0 100644
--- a/addons/tvm_ffi_orcjit/pyproject.toml
+++ b/addons/tvm_ffi_orcjit/pyproject.toml
@@ -19,7 +19,7 @@
 requires = [
   "scikit-build-core>=0.10.0",
   "apache-tvm-ffi>=0.1.14.post1",
-  "mlc-llvm-static==23.1.1",
+  "mlc-llvm-static==23.1.1.post0",
 ]
 build-backend = "scikit_build_core.build"
 
diff --git 
a/addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_dll_import_generator.cc 
b/addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_dll_import_generator.cc
index 901f627f..69fa3fdb 100644
--- a/addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_dll_import_generator.cc
+++ b/addons/tvm_ffi_orcjit/src/ffi/llvm_patches/win_dll_import_generator.cc
@@ -38,6 +38,7 @@
 
 #include <llvm/ADT/DenseMap.h>
 #include <llvm/ExecutionEngine/JITLink/JITLink.h>
+#include <llvm/ExecutionEngine/JITLink/aarch64.h>
 #include <llvm/ExecutionEngine/JITLink/x86_64.h>
 #include <llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h>
 #include <llvm/Support/DynamicLibrary.h>
@@ -140,12 +141,15 @@ llvm::Error DLLImportDefinitionGenerator::tryToGenerate(
                                         G->getPointerSize(), 
llvm::jitlink::Linkage::Strong,
                                         llvm::jitlink::Scope::Local, false);
     // __imp_XXX pointer (GOT-like entry)
-    auto& Ptr = llvm::jitlink::x86_64::createAnonymousPointer(*G, Sec, 
&Target);
+    bool IsAArch64 = ES_.getTargetTriple().getArch() == llvm::Triple::aarch64;
+    auto& Ptr = IsAArch64 ? llvm::jitlink::aarch64::createAnonymousPointer(*G, 
Sec, &Target)
+                          : llvm::jitlink::x86_64::createAnonymousPointer(*G, 
Sec, &Target);
     Ptr.setName(G->intern(("__imp_" + *InternedName).str()));
     Ptr.setLinkage(llvm::jitlink::Linkage::Strong);
     Ptr.setScope(llvm::jitlink::Scope::Default);
     // XXX jump stub (PLT-like entry) for direct calls
-    auto& StubBlock = llvm::jitlink::x86_64::createPointerJumpStubBlock(*G, 
Sec, Ptr);
+    auto& StubBlock = IsAArch64 ? 
llvm::jitlink::aarch64::createPointerJumpStubBlock(*G, Sec, Ptr)
+                                : 
llvm::jitlink::x86_64::createPointerJumpStubBlock(*G, Sec, Ptr);
     G->addDefinedSymbol(StubBlock, 0, *InternedName, StubBlock.getSize(),
                         llvm::jitlink::Linkage::Strong, 
llvm::jitlink::Scope::Default, true, false);
   }

Reply via email to