Skip to content

双臂新张,四境通衢 · Add Linux and Windows arm64 CPU native packages#22

Merged
eric8810 merged 1 commit into
mainfrom
add-arm64-cpu-packages
Jul 21, 2026
Merged

双臂新张,四境通衢 · Add Linux and Windows arm64 CPU native packages#22
eric8810 merged 1 commit into
mainfrom
add-arm64-cpu-packages

Conversation

@eric8810

Copy link
Copy Markdown
Contributor

Motivation

有用户提出需要 arm64 的 Linux 和 Windows 版本。本 PR 把预编译 npm 平台集合从四个扩展到六个,新增 Linux arm64 (glibc)Windows arm64 两个 CPU-only native 包,版本 0.3.0 → 0.3.1

经核实,两个平台的 CPU 路径在官方依赖层面完全成立:pinned ONNX Runtime 1.22.0 NuGet 同时提供 runtimes/linux-arm64runtimes/win-arm64;OpenCV/clipper/stb/json 均为 platforms:[all] 源码,在 ARM runner 上原生可编;模型 bundle 平台无关。

Changes

核心构建

  • cmake/Dependencies.cmake — Windows 分支按 CMAKE_SYSTEM_PROCESSORwin-arm64/win-x64;Linux 扩展 aarch64linux-arm64/native(原为 FATAL_ERROR
  • bindings/node/CMakeLists.txt — Node addon 的编译期平台身份(LIGHT_OCR_NODE_PLATFORM_ID 等)同样按处理器区分 arm64,确保 load-time contract 比较与 descriptor 一致

平台契约

  • bindings/node/js/load-native.cjs — 平台识别 + 包名映射加 linux-arm64win32-arm64
  • tools/npm_release.py — PLATFORMS 加两平台;package_directories 从硬编码 6 改为 len(PLATFORMS) + 2
  • models/deps.lock.jsononnxruntime-cpu platforms 声明加 linux-arm64-gnuwindows-arm64

CI

  • npm-release.yml — build-native + test-packages 矩阵加 ubuntu-24.04-armwindows-11-arm;Windows CMake 用 -A ARM64;step name 改计数中性措辞
  • core.yml — tier1 矩阵加两个 ARM runner

版本与测试

  • CMakeLists.txt / bindings/node/package.json0.3.0 → 0.3.1
  • tests/python/test_npm_release.py — 数量断言改动态(len(PLATFORMS)),版本字符串改动态读取
  • tests/python/npm_release_fixtures.pycurrent_platform_id() 加 ARM 映射

文档 — CHANGELOG、README(中英)、bindings/node/README、docs/npm-packaging、docs/build-and-release、docs/napi-design 全部同步至六平台/八包

WebGPU

两个 ARM 平台均为 CPU-only。WebGPU 保持 x64-only,原因:

  • Linux arm64:官方 ONNX Runtime WebGPU Plugin EP 0.1.0 不提供 linux-arm64 二进制(已通过解包 NuGet 核实,runtimes/ 下仅有 linux-x64
  • Windows arm64:官方 plugin 有 win-arm64 二进制(含 dxcompiler/dxil),但 WebGPU 进入正式发布需通过真机 164 Gate Provider qualification;当前架构禁止未资格化包发布(npm_release.pyqualificationOnly 门禁)

两个 ARM CPU 包与 macOS 两条线完全对等。

Verification

  • ✅ Python 编译、JSON 有效性、load-native.cjs 语法
  • assemble 成功 stage 全部 6 个 native 平台 + facade(版本 0.3.1)
  • ✅ 依赖选择逻辑:两个 ARM 平台均匹配到 onnxruntime-cpu + 4 个 common 依赖
  • test_npm_release / test_npm_webgpu_release:8/9 通过(唯一失败的 npm pack 是本地内嵌 npm 工具链损坏 npm-prefix.js MODULE_NOT_FOUND,与代码无关,CI 标准环境不受影响)
  • ✅ 两轮 gpt-5.6-sol 代码评审:首轮发现 addon 平台身份 blocking bug(已修),次轮确认无 blocking、无新问题、四项修复全部 VERIFIED
  • ⏳ 真正的 ARM 真机编译/加载/OCR 验证将在本 PR 的 CI 中由 ubuntu-24.04-arm / windows-11-arm runner 执行

Review history

  • 第一轮 gpt-5.6-sol review:REQUEST CHANGES — 发现 bindings/node/CMakeLists.txt 把 addon 平台身份硬编码为 x64,ARM 包加载必失败
  • 修正后第二轮 review:无 blocking,仅指出两份文档漏改(已补)

🤖 Generated with assistance from DimCode

Expand the prebuilt npm platform set from four to six builds by adding
Linux arm64 (glibc) and Windows arm64 CPU-only native packages.

- cmake/Dependencies.cmake: select runtimes/linux-arm64 and runtimes/win-arm64
  from the pinned ONNX Runtime NuGet based on CMAKE_SYSTEM_PROCESSOR
- load-native.cjs + npm_release.PLATFORMS + deps.lock.json: register the two
  new platform identities, packages, and dependency RIDs
- npm-release.yml + core.yml: add ubuntu-24.04-arm and windows-11-arm runners
  with -A ARM64 for the Windows VS generator
- npm_release.package_directories + test_npm_release: drop the hard-coded
  package count in favor of len(PLATFORMS) + 2
- version bump 0.3.0 -> 0.3.1 per the conservative patch policy

WebGPU stays x64-only: the official plugin EP 0.1.0 ships no linux-arm64
binary, and windows-arm64 WebGPU has not passed the real-device Provider Gate
required for a production-qualified release.
@eric8810
eric8810 merged commit e58fbda into main Jul 21, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant