Skip to content

Add Linux arm64 support to the SDK v2 packaging pipelines#894

Open
baijumeswani wants to merge 2 commits into
mainfrom
baijumeswani/linux-arm64
Open

Add Linux arm64 support to the SDK v2 packaging pipelines#894
baijumeswani wants to merge 2 commits into
mainfrom
baijumeswani/linux-arm64

Conversation

@baijumeswani

Copy link
Copy Markdown
Collaborator

Adds first-class Linux arm64 support across the SDK v2 build, test, and packaging pipelines. Every package format the pipeline already produces (C++ tgz, Runtime NuGet, Python wheel, npm tarball) now includes a linux-arm64 payload, built and tested natively on the onnxruntime-linux-ARM64-CPU-2019 pool.

Initial Linux ARM64 support is CPU-only.

Copilot AI review requested due to automatic review settings July 21, 2026 17:24
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Jul 21, 2026 5:24pm

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds native CPU-only Linux ARM64 support across SDK v2 build, test, and packaging workflows.

Changes:

  • Adds ARM64 native builds and C++, C#, Python, and JavaScript test stages.
  • Packages Linux ARM64 binaries in C++ archives, NuGet, Python wheels, and npm tarballs.
  • Updates runtime detection, dependency selection, WebGPU fallback behavior, tests, and documentation.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk_v2/python/test/unit/test_lib_loader.py Tests ARM64 platform detection.
sdk_v2/python/test/unit/test_build_backend.py Tests dependency-pin rewriting.
sdk_v2/python/src/foundry_local_sdk/_native/lib_loader.py Detects Linux ARM64 payloads.
sdk_v2/python/pyproject.toml Adds CPU-only ARM64 dependencies.
sdk_v2/python/_build_backend/__init__.py Rewrites plain ORT package pins.
sdk_v2/js/script/install-native.cjs Supports ARM64 and fails on missing payloads.
sdk_v2/cpp/triplets/arm64-linux.cmake Defines the ARM64 vcpkg triplet.
sdk_v2/cpp/test/internal_api/webgpu_ep_bootstrapper_test.cc Adds WebGPU bootstrapper tests.
sdk_v2/cpp/test/CMakeLists.txt Registers the new C++ test file.
sdk_v2/cpp/src/ep_detection/webgpu_ep_bootstrapper.h Documents ARM64 WebGPU behavior.
sdk_v2/cpp/src/ep_detection/webgpu_ep_bootstrapper.cc Gracefully disables unavailable ARM64 WebGPU.
sdk_v2/cpp/nuget/test_pack.py Tests NuGet staging and RID mapping.
sdk_v2/cpp/nuget/pack.py Stages the Linux ARM64 runtime.
sdk_v2/cpp/nuget/Microsoft.AI.Foundry.Local.Runtime.nuspec Documents the ARM64 payload.
sdk_v2/cpp/cmake/FindOnnxRuntimeGenAI.cmake Selects ARM64 GenAI binaries.
sdk_v2/cpp/cmake/FindOnnxRuntime.cmake Selects CPU-only ARM64 ORT binaries.
.pipelines/v2/templates/steps-test-python.yml Supports system Python on ARM64 agents.
.pipelines/v2/templates/steps-test-js.yml Enables Linux ARM64 JavaScript tests.
.pipelines/v2/templates/steps-pack-nuget.yml Includes the ARM64 native artifact.
.pipelines/v2/templates/steps-pack-js.yml Merges the ARM64 npm prebuild.
.pipelines/v2/templates/steps-pack-cpp-sdk.yml Produces an ARM64 C++ archive.
.pipelines/v2/templates/steps-build-python.yml Supports ARM64 system Python builds.
.pipelines/v2/templates/steps-build-linux.yml Parameterizes Linux CPU architecture.
.pipelines/v2/templates/steps-build-js.yml Builds and stages ARM64 Node addons.
.pipelines/v2/templates/stages-python.yml Adds ARM64 Python build and test stages.
.pipelines/v2/templates/stages-js.yml Adds ARM64 JavaScript build and test stages.
.pipelines/v2/templates/stages-cs.yml Adds ARM64 C# testing.
.pipelines/v2/templates/stages-build-native.yml Adds native ARM64 build and packaging inputs.
.pipelines/v2/sdk_v2-pipeline-plan.md Documents the expanded pipeline matrix.
.pipelines/v2/sdk_v2-js-pipeline-plan.md Documents ARM64 JavaScript packaging.

"openai>=2.24.0",
"onnxruntime-gpu==0.0.0; platform_system == 'Linux'",
"onnxruntime-gpu==0.0.0; platform_system == 'Linux' and platform_machine == 'x86_64'",
"onnxruntime==0.0.0; platform_system == 'Linux' and platform_machine == 'aarch64'",
"onnxruntime-core==0.0.0; platform_system != 'Linux'",
"onnxruntime-genai-cuda==0.0.0; platform_system == 'Linux'",
"onnxruntime-genai-cuda==0.0.0; platform_system == 'Linux' and platform_machine == 'x86_64'",
"onnxruntime-genai==0.0.0; platform_system == 'Linux' and platform_machine == 'aarch64'",
Comment on lines +6 to +8
Run with:
python -m unittest test_pack (from sdk_v2/cpp/nuget/)
python test_pack.py (direct invocation)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OR, include more comments/details on when this should be run and what the purpose of this testing script is

Comment on lines +10 to +14
// The linux-arm64 "no WebGPU payload" path relies on the compile-time
// kPlatformKey being "linux-arm64", which causes GetPackageMetadata() to
// throw at the start of DownloadAndRegister — caught and returned as false.
// That path can only be exercised on an ARM64 Linux host; the contract is
// documented by the header comment and the static preprocessor block.
Comment on lines +96 to +100
def _run_stage(self, rid_arg: str) -> tuple[Path, Path]:
"""
Run pack.stage() with a single platform artifact.
Returns (staging_dir, artifact_dir).
"""

@prathikr prathikr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add to the PR description all the new unit tests that have been introduced and their purposes?

dependsOn:
- compute_version
- cpp_build_linux_arm64
- cpp_build_win_x64

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this stage depend on win x64?

# src/foundry_local_sdk/_native/<rid>/). On Windows that native artifact carries
# the reg-free WinML 2.x runtime, so the single wheel includes WinML support.
#
# linux-arm64 is CPU-only; it uses onnxruntime + onnxruntime-genai (plain

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you include why this is the case and what needs to happen in order to enable linux-arm64+gpu support?

rid: 'linux-arm64'
useSystemPython: true
outputDir: '$(Build.ArtifactStagingDirectory)/python-sdk'
# Assert the produced wheel has the correct platform tag and bundles the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we should be doing for all platforms?

set(_ORT_LIB_DIR "${ort_gpu_linux_SOURCE_DIR}/runtimes/${_ORT_PLATFORM}/native")
message(STATUS "OnnxRuntime GPU Linux package: ${ort_gpu_linux_SOURCE_DIR}")
else()
# linux-arm64: libonnxruntime.so is included directly in the Microsoft.ML.OnnxRuntime.Foundry

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this impact our future process for removing the .Foundry package and relying on the plain ort cpu package (once all eps are plugin)?

Comment on lines +6 to +8
Run with:
python -m unittest test_pack (from sdk_v2/cpp/nuget/)
python test_pack.py (direct invocation)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OR, include more comments/details on when this should be run and what the purpose of this testing script is


// Platform-specific package metadata is baked into the binary to keep
// verification inputs fixed at build time.
// verification inputs fixed at build time. linux-arm64 is intentionally absent

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the CDN package updated? Might need to do this before merging this PR

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.

3 participants