From 43e18b98a4122a5d13460ac6ec3fd2d482637b6d Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Fri, 5 Jun 2026 10:09:13 -0700 Subject: [PATCH 01/10] adjust --- .pipelines/v2/sdk_v2-pipeline-plan.md | 2 +- .pipelines/v2/templates/steps-build-windows.yml | 2 +- .pipelines/v2/templates/steps-prefetch-nuget.yml | 6 +++--- sdk_v2/DEVELOPMENT.md | 2 +- sdk_v2/cpp/build.py | 2 +- sdk_v2/cpp/cmake/FindOnnxRuntime.cmake | 16 +++++----------- .../Microsoft.AI.Foundry.Local.Runtime.nuspec | 2 +- sdk_v2/cpp/nuget/pack.py | 2 +- sdk_v2/js/script/install-native.cjs | 2 +- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/.pipelines/v2/sdk_v2-pipeline-plan.md b/.pipelines/v2/sdk_v2-pipeline-plan.md index 68e920d9f..e2262d13f 100644 --- a/.pipelines/v2/sdk_v2-pipeline-plan.md +++ b/.pipelines/v2/sdk_v2-pipeline-plan.md @@ -254,7 +254,7 @@ purposes: Versions are pipeline-level variables, currently: -* `ortVersion` `1.25.1` (`Microsoft.ML.OnnxRuntime.Foundry`) +* `ortVersion` `1.25.1` (`Microsoft.ML.OnnxRuntime`) * `ortVersionWinml` `1.23.2.3` (WinML-aligned ORT line, used by the WinML build stages) * `genaiVersion` `0.13.2` (`Microsoft.ML.OnnxRuntimeGenAI.Foundry`) * `winmlVersion` `1.8.2192` (`Microsoft.WindowsAppSDK.ML`) diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index ba2d82d79..98ea7184e 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -7,7 +7,7 @@ # Parameters: # arch – 'x64' or 'arm64' (arm64 is cross-compiled, no tests) # buildConfig – CMake config (Debug, Release, RelWithDebInfo, MinSizeRel) -# ortVersion – Microsoft.ML.OnnxRuntime.Foundry version +# ortVersion – Microsoft.ML.OnnxRuntime version # genaiVersion – Microsoft.ML.OnnxRuntimeGenAI.Foundry version # winmlVersion – Microsoft.WindowsAppSDK.ML version # useWinml – Build the WinML variant (--use_winml). Caller is responsible diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 70a83f7c2..706b954be 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -5,7 +5,7 @@ # `KEY=PATH` pairs to pass to build.py --cmake_extra_defines. # # Parameters: -# ortVersion – Microsoft.ML.OnnxRuntime.Foundry version +# ortVersion – Microsoft.ML.OnnxRuntime version # genaiVersion – Microsoft.ML.OnnxRuntimeGenAI.Foundry version # winmlVersion – Microsoft.WindowsAppSDK.ML version (Windows only) # includeWinml – Download WinML and emit WINML_EP_CATALOG_FETCH_URL @@ -51,7 +51,7 @@ steps: $packages = @( @{ key = 'genai'; id = 'Microsoft.ML.OnnxRuntimeGenAI.Foundry'; version = '${{ parameters.genaiVersion }}' }, - @{ key = 'ort'; id = 'Microsoft.ML.OnnxRuntime.Foundry'; version = '${{ parameters.ortVersion }}' } + @{ key = 'ort'; id = 'Microsoft.ML.OnnxRuntime'; version = '${{ parameters.ortVersion }}' } ) if ($${{ parameters.includeOrtGpuLinux }}) { $packages += @{ key = 'ort_gpu_linux'; id = 'Microsoft.ML.OnnxRuntime.Gpu.Linux'; version = '${{ parameters.ortVersion }}' } @@ -122,7 +122,7 @@ steps: declare -a entries=( "genai:Microsoft.ML.OnnxRuntimeGenAI.Foundry:${{ parameters.genaiVersion }}" - "ort:Microsoft.ML.OnnxRuntime.Foundry:${{ parameters.ortVersion }}" + "ort:Microsoft.ML.OnnxRuntime:${{ parameters.ortVersion }}" ) if [ "${{ parameters.includeWinml }}" = "True" ]; then # WinML is Windows-only; the bash branch should never receive includeWinml=true. diff --git a/sdk_v2/DEVELOPMENT.md b/sdk_v2/DEVELOPMENT.md index c9117dd13..2e674016c 100644 --- a/sdk_v2/DEVELOPMENT.md +++ b/sdk_v2/DEVELOPMENT.md @@ -103,6 +103,6 @@ See `pwsh ./build_and_test_all.ps1 -?` for the full parameter list. `sdk_v2/cpp/build///`; bypassing `build.py` puts the binary somewhere else. * **Switching between WinML and non-WinML** — the C++ FetchContent NuGet - packages (`Microsoft.ML.OnnxRuntime.Foundry` vs `.WinML`) are cached and + packages (`Microsoft.ML.OnnxRuntime` vs `.WinML`) are cached and do not auto-refresh on variant flip. If you hit linker errors after toggling `-UseWinml`, wipe `sdk_v2/cpp/build/` and rerun. diff --git a/sdk_v2/cpp/build.py b/sdk_v2/cpp/build.py index f4e2a6a39..9416951ab 100644 --- a/sdk_v2/cpp/build.py +++ b/sdk_v2/cpp/build.py @@ -163,7 +163,7 @@ class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescript parser.add_argument( "--use_winml", action="store_true", help="Enable the WinML EP catalog (Microsoft.WindowsAppSDK.ML) for hardware EP " - "discovery. ORT itself still comes from Microsoft.ML.OnnxRuntime.Foundry; " + "discovery. ORT itself still comes from Microsoft.ML.OnnxRuntime; " "this flag only adds the WinML EP catalog client.", ) parser.add_argument( diff --git a/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake b/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake index 2ec92011f..b1a18a9d1 100644 --- a/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake +++ b/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake @@ -1,8 +1,8 @@ # Copyright (c) Microsoft. All rights reserved. # Find/acquire ONNX Runtime. # -# ORT is always sourced from Microsoft.ML.OnnxRuntime.Foundry (or -# Microsoft.ML.OnnxRuntime on Android) via FetchContent — nuget.org for releases, +# ORT is always sourced from Microsoft.ML.OnnxRuntime via FetchContent — +# nuget.org for releases, # the ORT-Nightly ADO feed for -dev- versions. The FOUNDRY_LOCAL_USE_WINML flag # does NOT change the ORT package source; it only: # - selects a WinML-compatible ORT version (see version branch below), and @@ -50,7 +50,7 @@ endif() if(FOUNDRY_LOCAL_USE_WINML) # FOUNDRY_LOCAL_USE_WINML opts in to the WinML EP catalog (see FindWinMLEpCatalog.cmake) but # does NOT change where ORT comes from. We always link against our own ORT - # (Microsoft.ML.OnnxRuntime.Foundry) because it enables CUDA and WebGPU EPs. + # (Microsoft.ML.OnnxRuntime) because it enables CUDA and WebGPU EPs. # # Which onnxruntime.dll the process actually binds to at runtime is determined by the # binding-side preload contract (see sdk_v2/cpp/docs/OrtRuntimeLoading.md), not by build @@ -58,7 +58,7 @@ if(FOUNDRY_LOCAL_USE_WINML) # tests and examples zero-config, but is not a correctness guarantee for arbitrary # deployments — bindings preload the intended onnxruntime.dll by absolute path before # loading foundry_local. - message(STATUS "FOUNDRY_LOCAL_USE_WINML=ON: WinML EP catalog enabled; ORT still sourced from Microsoft.ML.OnnxRuntime.Foundry") + message(STATUS "FOUNDRY_LOCAL_USE_WINML=ON: WinML EP catalog enabled; ORT still sourced from Microsoft.ML.OnnxRuntime") endif() if(ORT_HOME) @@ -96,13 +96,7 @@ else() message(STATUS "ORT_VERSION=${ORT_VERSION} (from ${_DEPS_FILE})") endif() if(NOT ORT_PACKAGE_NAME) - if(ANDROID) - # The Foundry meta-package may not contain Android binaries; - # use the base ORT package which includes the AAR. - set(ORT_PACKAGE_NAME "Microsoft.ML.OnnxRuntime") - else() - set(ORT_PACKAGE_NAME "Microsoft.ML.OnnxRuntime.Foundry") - endif() + set(ORT_PACKAGE_NAME "Microsoft.ML.OnnxRuntime") endif() # ORT_FETCH_URL can be set externally (e.g. for CI where nuget.org is blocked). diff --git a/sdk_v2/cpp/nuget/Microsoft.AI.Foundry.Local.Runtime.nuspec b/sdk_v2/cpp/nuget/Microsoft.AI.Foundry.Local.Runtime.nuspec index faf12ce63..bfda50c92 100644 --- a/sdk_v2/cpp/nuget/Microsoft.AI.Foundry.Local.Runtime.nuspec +++ b/sdk_v2/cpp/nuget/Microsoft.AI.Foundry.Local.Runtime.nuspec @@ -18,7 +18,7 @@ - + diff --git a/sdk_v2/cpp/nuget/pack.py b/sdk_v2/cpp/nuget/pack.py index bcda45e8f..5c2182335 100644 --- a/sdk_v2/cpp/nuget/pack.py +++ b/sdk_v2/cpp/nuget/pack.py @@ -73,7 +73,7 @@ def _parse_args() -> argparse.Namespace: parser.add_argument("--version", required=True, help="Package version (e.g. 0.1.0 or 0.1.0-dev.20260419).") parser.add_argument("--ort_version", required=True, - help="Minimum Microsoft.ML.OnnxRuntime.Foundry version.") + help="Minimum Microsoft.ML.OnnxRuntime version.") parser.add_argument("--genai_version", required=True, help="Minimum Microsoft.ML.OnnxRuntimeGenAI.Foundry version.") parser.add_argument("--package_id", default="Microsoft.AI.Foundry.Local.Runtime", diff --git a/sdk_v2/js/script/install-native.cjs b/sdk_v2/js/script/install-native.cjs index 9c6205dea..f8d4627e5 100644 --- a/sdk_v2/js/script/install-native.cjs +++ b/sdk_v2/js/script/install-native.cjs @@ -57,7 +57,7 @@ if (!fs.existsSync(depsPath)) { const deps = JSON.parse(fs.readFileSync(depsPath, 'utf8')); const isLinuxX64 = os.platform() === 'linux' && os.arch() === 'x64'; -const ortPackageName = isLinuxX64 ? 'Microsoft.ML.OnnxRuntime.Gpu.Linux' : 'Microsoft.ML.OnnxRuntime.Foundry'; +const ortPackageName = isLinuxX64 ? 'Microsoft.ML.OnnxRuntime.Gpu.Linux' : 'Microsoft.ML.OnnxRuntime'; const ortVersion = deps.onnxruntime.version; const genaiVersion = deps['onnxruntime-genai'].version; From 935696811fa3bd3d79aae8c36dca435240b689b8 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 8 Jun 2026 09:27:35 -0700 Subject: [PATCH 02/10] combine --- sdk_v2/deps_versions.json | 4 ++-- sdk_v2/deps_versions_winml.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk_v2/deps_versions.json b/sdk_v2/deps_versions.json index 204f90a7c..ee73c5986 100644 --- a/sdk_v2/deps_versions.json +++ b/sdk_v2/deps_versions.json @@ -1,5 +1,5 @@ { "_comment": "Single source of truth for ORT and ORT-GenAI versions in sdk_v2. Read by sdk_v2/cpp/cmake/FindOnnxRuntime*.cmake and sdk_v2/python/_build_backend/__init__.py.", - "onnxruntime": { "version": "1.25.1" }, - "onnxruntime-genai": { "version": "0.13.2" } + "onnxruntime": { "version": "1.26.0" }, + "onnxruntime-genai": { "version": "0.14.0" } } diff --git a/sdk_v2/deps_versions_winml.json b/sdk_v2/deps_versions_winml.json index c2f43bfb5..9203ee468 100644 --- a/sdk_v2/deps_versions_winml.json +++ b/sdk_v2/deps_versions_winml.json @@ -1,5 +1,5 @@ { "_comment": "WinML variant of sdk_v2/deps_versions.json. Selected by FOUNDRY_LOCAL_USE_WINML=ON (cmake) and FL_PYTHON_PACKAGE_NAME=foundry-local-sdk-winml (python build backend).", - "onnxruntime": { "version": "1.23.2.3" }, - "onnxruntime-genai": { "version": "0.13.2" } + "onnxruntime": { "version": "1.26.0" }, + "onnxruntime-genai": { "version": "0.14.0" } } From a8ec253f29fb31035e638a049b982be4ada624e2 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 8 Jun 2026 09:28:29 -0700 Subject: [PATCH 03/10] copilot Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- sdk_v2/cpp/cmake/FindOnnxRuntime.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake b/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake index b1a18a9d1..7fb4eae67 100644 --- a/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake +++ b/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake @@ -1,9 +1,9 @@ # Copyright (c) Microsoft. All rights reserved. # Find/acquire ONNX Runtime. # -# ORT is always sourced from Microsoft.ML.OnnxRuntime via FetchContent — -# nuget.org for releases, -# the ORT-Nightly ADO feed for -dev- versions. The FOUNDRY_LOCAL_USE_WINML flag +# ORT is sourced from Microsoft.ML.OnnxRuntime via FetchContent — nuget.org for releases, +# the ORT-Nightly ADO feed for -dev- versions. On Linux, runtime binaries are fetched from +# Microsoft.ML.OnnxRuntime.Gpu.Linux while headers still come from Microsoft.ML.OnnxRuntime. # does NOT change the ORT package source; it only: # - selects a WinML-compatible ORT version (see version branch below), and # - opts in to the WinML EP catalog (handled by FindWinMLEpCatalog.cmake). From 2259a3adc06215db2e1347aaa843df9ecf38a062 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 8 Jun 2026 10:19:49 -0700 Subject: [PATCH 04/10] read ver from json --- .pipelines/foundry-local-packaging.yml | 17 +----- .../v2/templates/stages-build-native.yml | 32 ++--------- .pipelines/v2/templates/stages-sdk-v2.yml | 15 ++---- .pipelines/v2/templates/steps-build-linux.yml | 12 ++--- .pipelines/v2/templates/steps-build-macos.yml | 12 ++--- .../v2/templates/steps-build-windows.yml | 25 ++++----- .pipelines/v2/templates/steps-pack-nuget.yml | 19 ++++--- .../v2/templates/steps-prefetch-nuget.yml | 29 ++++------ .../v2/templates/steps-read-deps-versions.yml | 54 +++++++++++++++++++ sdk_v2/cpp/cmake/FindOnnxRuntime.cmake | 10 ++-- sdk_v2/cpp/cmake/FindOnnxRuntimeGenAI.cmake | 15 ++---- sdk_v2/cpp/cmake/FindWinMLEpCatalog.cmake | 17 +++--- sdk_v2/deps_versions.json | 5 +- sdk_v2/deps_versions_winml.json | 5 -- sdk_v2/python/_build_backend/__init__.py | 14 ++--- sdk_v2/python/pyproject.toml | 7 ++- 16 files changed, 130 insertions(+), 158 deletions(-) create mode 100644 .pipelines/v2/templates/steps-read-deps-versions.yml delete mode 100644 sdk_v2/deps_versions_winml.json diff --git a/.pipelines/foundry-local-packaging.yml b/.pipelines/foundry-local-packaging.yml index e67dc61c6..f293d6069 100644 --- a/.pipelines/foundry-local-packaging.yml +++ b/.pipelines/foundry-local-packaging.yml @@ -53,18 +53,7 @@ parameters: variables: - group: FoundryLocal-ESRP-Signing -# C++ SDK (sdk_v2/cpp) native dependency versions. Must match cmake defaults -# in sdk_v2/deps_versions.json and sdk_v2/deps_versions_winml.json. -- name: cppOrtVersion - value: '1.25.1' -- name: cppOrtVersionWinml - # Pinned to the WinML-aligned ORT line so foundry_local.dll's ORT ABI matches - # the WinML EP catalog plugins it loads. See FindOnnxRuntime.cmake. - value: '1.23.2.3' -- name: cppGenaiVersion - value: '0.13.2' -- name: cppWinmlVersion - value: '1.8.2192' +# All ORT/GenAI/WinML versions are read from sdk_v2/deps_versions.json at runtime. - name: cppBuildConfig value: 'RelWithDebInfo' @@ -268,7 +257,3 @@ extends: - template: v2/templates/stages-sdk-v2.yml parameters: buildConfig: $(cppBuildConfig) - ortVersion: $(cppOrtVersion) - ortVersionWinml: $(cppOrtVersionWinml) - genaiVersion: $(cppGenaiVersion) - winmlVersion: $(cppWinmlVersion) diff --git a/.pipelines/v2/templates/stages-build-native.yml b/.pipelines/v2/templates/stages-build-native.yml index 295b9a934..645900840 100644 --- a/.pipelines/v2/templates/stages-build-native.yml +++ b/.pipelines/v2/templates/stages-build-native.yml @@ -8,18 +8,12 @@ # (win-x64, win-arm64, linux-x64, osx-arm64) # pack_nuget_winml – Microsoft.AI.Foundry.Local.Runtime.WinML # (win-x64, win-arm64; both built with --use_winml) +# +# ORT/GenAI versions are read from sdk_v2/deps_versions.json at runtime. parameters: - name: buildConfig type: string -- name: ortVersion - type: string -- name: ortVersionWinml - type: string -- name: genaiVersion - type: string -- name: winmlVersion - type: string stages: @@ -52,9 +46,6 @@ stages: parameters: arch: x64 buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} - winmlVersion: ${{ parameters.winmlVersion }} runTests: true stageHeaders: true @@ -84,14 +75,11 @@ stages: parameters: arch: arm64 buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} - winmlVersion: ${{ parameters.winmlVersion }} runTests: false stageHeaders: false # ==================================================================== - # Linux x64 — build + test + # Linux x64— build + test # ==================================================================== - stage: cpp_build_linux_x64 displayName: 'C++ Native: Linux x64' @@ -115,8 +103,6 @@ stages: - template: steps-build-linux.yml parameters: buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} runTests: true # ==================================================================== @@ -146,8 +132,6 @@ stages: - template: steps-build-macos.yml parameters: buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} runTests: true # ==================================================================== @@ -181,9 +165,6 @@ stages: parameters: arch: x64 buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersionWinml }} - genaiVersion: ${{ parameters.genaiVersion }} - winmlVersion: ${{ parameters.winmlVersion }} useWinml: true runTests: true stageHeaders: false @@ -214,9 +195,6 @@ stages: parameters: arch: arm64 buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersionWinml }} - genaiVersion: ${{ parameters.genaiVersion }} - winmlVersion: ${{ parameters.winmlVersion }} useWinml: true runTests: false stageHeaders: false @@ -261,8 +239,6 @@ stages: steps: - template: steps-pack-nuget.yml parameters: - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} variant: base # ==================================================================== @@ -297,6 +273,4 @@ stages: steps: - template: steps-pack-nuget.yml parameters: - ortVersion: ${{ parameters.ortVersionWinml }} - genaiVersion: ${{ parameters.genaiVersion }} variant: winml diff --git a/.pipelines/v2/templates/stages-sdk-v2.yml b/.pipelines/v2/templates/stages-sdk-v2.yml index c2cae47d1..2c998e764 100644 --- a/.pipelines/v2/templates/stages-sdk-v2.yml +++ b/.pipelines/v2/templates/stages-sdk-v2.yml @@ -9,19 +9,14 @@ # publishes the `version-info` pipeline artifact (containing sdkVersion.txt # and pyVersion.txt). All downstream stages read from that artifact rather # than recomputing a timestamp. +# +# ORT/GenAI/WinML versions are read from sdk_v2/deps_versions.json at runtime +# by each build job — no version parameters needed here. parameters: - name: buildConfig type: string default: 'RelWithDebInfo' -- name: ortVersion - type: string -- name: ortVersionWinml - type: string -- name: genaiVersion - type: string -- name: winmlVersion - type: string stages: @@ -29,10 +24,6 @@ stages: - template: stages-build-native.yml parameters: buildConfig: ${{ parameters.buildConfig }} - ortVersion: ${{ parameters.ortVersion }} - ortVersionWinml: ${{ parameters.ortVersionWinml }} - genaiVersion: ${{ parameters.genaiVersion }} - winmlVersion: ${{ parameters.winmlVersion }} # ── C# SDK (base) ── - template: stages-cs.yml diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index b16b13fdd..081daa6a8 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -3,14 +3,12 @@ # Pool: onnxruntime-Ubuntu2404-AMD-CPU. Has the toolchain pre-installed but we # still bootstrap vcpkg and pre-download NuGet packages from the aiinfra feed # for version pinning. +# +# Reads ORT/GenAI versions from sdk_v2/deps_versions.json (single source of truth). parameters: - name: buildConfig type: string -- name: ortVersion - type: string -- name: genaiVersion - type: string - name: runTests type: boolean default: false @@ -23,10 +21,12 @@ steps: "$(Build.BinariesDirectory)/vcpkg/bootstrap-vcpkg.sh" -disableMetrics displayName: 'Bootstrap vcpkg' +- template: steps-read-deps-versions.yml + parameters: + shell: bash + - template: steps-prefetch-nuget.yml parameters: - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} winmlVersion: '' includeWinml: false includeOrtGpuLinux: true diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index 278bdbff8..dbecb7f51 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -1,14 +1,12 @@ # Reusable macOS build steps for the Foundry Local C++ SDK. # # Pool: AcesShared (Sequoia, Apple Silicon). Builds and tests natively. +# +# Reads ORT/GenAI versions from sdk_v2/deps_versions.json (single source of truth). parameters: - name: buildConfig type: string -- name: ortVersion - type: string -- name: genaiVersion - type: string - name: runTests type: boolean default: false @@ -32,10 +30,12 @@ steps: pkg-config --version displayName: 'Verify build tools' +- template: steps-read-deps-versions.yml + parameters: + shell: bash + - template: steps-prefetch-nuget.yml parameters: - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} winmlVersion: '' includeWinml: false shell: bash diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index 98ea7184e..eaf46a30a 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -4,14 +4,12 @@ # builds, optionally tests, and stages artifacts for the parent stage's # templateContext.outputs. # +# Reads all dependency versions from sdk_v2/deps_versions.json (single source of truth). +# # Parameters: # arch – 'x64' or 'arm64' (arm64 is cross-compiled, no tests) # buildConfig – CMake config (Debug, Release, RelWithDebInfo, MinSizeRel) -# ortVersion – Microsoft.ML.OnnxRuntime version -# genaiVersion – Microsoft.ML.OnnxRuntimeGenAI.Foundry version -# winmlVersion – Microsoft.WindowsAppSDK.ML version -# useWinml – Build the WinML variant (--use_winml). Caller is responsible -# for passing the WinML-aligned ortVersion (e.g. 1.23.2.3). +# useWinml – Build the WinML variant (--use_winml). # runTests – Whether to run tests # stageHeaders – Whether to stage public headers as a separate artifact @@ -21,12 +19,6 @@ parameters: values: ['x64', 'arm64'] - name: buildConfig type: string -- name: ortVersion - type: string -- name: genaiVersion - type: string -- name: winmlVersion - type: string - name: useWinml type: boolean default: false @@ -49,6 +41,10 @@ steps: versionSpec: '3.12' architecture: 'x64' +- template: steps-read-deps-versions.yml + parameters: + shell: pwsh + - script: | git clone https://github.com/microsoft/vcpkg.git $(Build.BinariesDirectory)\vcpkg call $(Build.BinariesDirectory)\vcpkg\bootstrap-vcpkg.bat -disableMetrics @@ -58,9 +54,6 @@ steps: - template: steps-prefetch-nuget.yml parameters: - ortVersion: ${{ parameters.ortVersion }} - genaiVersion: ${{ parameters.genaiVersion }} - winmlVersion: ${{ parameters.winmlVersion }} includeWinml: ${{ parameters.useWinml }} shell: pwsh @@ -103,7 +96,7 @@ steps: --configure --build --config ${{ parameters.buildConfig }} --cmake_generator "Visual Studio 17 2022" - --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} + --use_winml --winml_sdk_version $(winmlVersion) --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (x64, WinML)' workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp @@ -130,7 +123,7 @@ steps: --configure --build --arm64 --config ${{ parameters.buildConfig }} --cmake_generator "Visual Studio 17 2022" - --use_winml --winml_sdk_version ${{ parameters.winmlVersion }} + --use_winml --winml_sdk_version $(winmlVersion) --cmake_extra_defines $(cmakeFetchDefines) displayName: 'Configure and build (arm64 cross-compile, WinML)' workingDirectory: $(Build.SourcesDirectory)/sdk_v2/cpp diff --git a/.pipelines/v2/templates/steps-pack-nuget.yml b/.pipelines/v2/templates/steps-pack-nuget.yml index bde97d772..7efbf5669 100644 --- a/.pipelines/v2/templates/steps-pack-nuget.yml +++ b/.pipelines/v2/templates/steps-pack-nuget.yml @@ -4,6 +4,9 @@ # Inputs are downloaded by the parent job's templateContext.inputs into # $(Pipeline.Workspace)//. # +# Reads ortVersion and genaiVersion from sdk_v2/deps_versions.json at runtime +# (set as job variables by an inline step below). +# # Variants: # base -> Microsoft.AI.Foundry.Local.Runtime # (win-x64, win-arm64, linux-x64, osx-arm64) @@ -11,10 +14,6 @@ # (win-x64, win-arm64 only — both built with --use_winml) parameters: -- name: ortVersion - type: string -- name: genaiVersion - type: string - name: variant type: string default: 'base' @@ -30,6 +29,10 @@ steps: inputs: versionSpec: '3.x' +- template: steps-read-deps-versions.yml + parameters: + shell: pwsh + # List downloaded pipeline artifacts so we can diagnose missing/misplaced files. - task: PowerShell@2 displayName: 'List downloaded artifacts' @@ -63,8 +66,8 @@ steps: python "$(Build.SourcesDirectory)/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime" ` - --ort_version "${{ parameters.ortVersion }}" ` - --genai_version "${{ parameters.genaiVersion }}" ` + --ort_version "$(ortVersion)" ` + --genai_version "$(genaiVersion)" ` --win_x64 "$(Pipeline.Workspace)/cpp-native-win-x64" ` --win_arm64 "$(Pipeline.Workspace)/cpp-native-win-arm64" ` --linux_x64 "$(Pipeline.Workspace)/cpp-native-linux-x64" ` @@ -92,8 +95,8 @@ steps: python "$(Build.SourcesDirectory)/sdk_v2/cpp/nuget/pack.py" ` --version "$version" ` --package_id "Microsoft.AI.Foundry.Local.Runtime.WinML" ` - --ort_version "${{ parameters.ortVersion }}" ` - --genai_version "${{ parameters.genaiVersion }}" ` + --ort_version "$(ortVersion)" ` + --genai_version "$(genaiVersion)" ` --win_x64 "$(Pipeline.Workspace)/cpp-native-win-x64-winml" ` --win_arm64 "$(Pipeline.Workspace)/cpp-native-win-arm64-winml" ` --output_dir "$outDir" diff --git a/.pipelines/v2/templates/steps-prefetch-nuget.yml b/.pipelines/v2/templates/steps-prefetch-nuget.yml index 706b954be..498c80677 100644 --- a/.pipelines/v2/templates/steps-prefetch-nuget.yml +++ b/.pipelines/v2/templates/steps-prefetch-nuget.yml @@ -4,22 +4,15 @@ # Sets the pipeline variable `cmakeFetchDefines` containing the space-separated # `KEY=PATH` pairs to pass to build.py --cmake_extra_defines. # +# Reads ortVersion, genaiVersion, and winmlVersion from job-level variables +# set by steps-read-deps-versions.yml (which must run first). +# # Parameters: -# ortVersion – Microsoft.ML.OnnxRuntime version -# genaiVersion – Microsoft.ML.OnnxRuntimeGenAI.Foundry version -# winmlVersion – Microsoft.WindowsAppSDK.ML version (Windows only) # includeWinml – Download WinML and emit WINML_EP_CATALOG_FETCH_URL # includeOrtGpuLinux – Also download Microsoft.ML.OnnxRuntime.Gpu.Linux (Linux only) # shell – 'pwsh' (Windows/macOS) or 'bash' (Linux) parameters: -- name: ortVersion - type: string -- name: genaiVersion - type: string -- name: winmlVersion - type: string - default: '' - name: includeWinml type: boolean default: false @@ -50,11 +43,11 @@ steps: $feed = "https://www.nuget.org/api/v2/package" $packages = @( - @{ key = 'genai'; id = 'Microsoft.ML.OnnxRuntimeGenAI.Foundry'; version = '${{ parameters.genaiVersion }}' }, - @{ key = 'ort'; id = 'Microsoft.ML.OnnxRuntime'; version = '${{ parameters.ortVersion }}' } + @{ key = 'genai'; id = 'Microsoft.ML.OnnxRuntimeGenAI.Foundry'; version = '$(genaiVersion)' }, + @{ key = 'ort'; id = 'Microsoft.ML.OnnxRuntime'; version = '$(ortVersion)' } ) if ($${{ parameters.includeOrtGpuLinux }}) { - $packages += @{ key = 'ort_gpu_linux'; id = 'Microsoft.ML.OnnxRuntime.Gpu.Linux'; version = '${{ parameters.ortVersion }}' } + $packages += @{ key = 'ort_gpu_linux'; id = 'Microsoft.ML.OnnxRuntime.Gpu.Linux'; version = '$(ortVersion)' } } $defines = @() @@ -81,9 +74,9 @@ steps: $winmlDir = "$cacheDir/winml-resolved" if (Test-Path $winmlDir) { Remove-Item -Recurse -Force $winmlDir } New-Item -ItemType Directory -Force -Path $winmlDir | Out-Null - Write-Host "Resolving Microsoft.WindowsAppSDK.ML ${{ parameters.winmlVersion }} via nuget install" + Write-Host "Resolving Microsoft.WindowsAppSDK.ML $(winmlVersion) via nuget install" nuget install Microsoft.WindowsAppSDK.ML ` - -Version '${{ parameters.winmlVersion }}' ` + -Version '$(winmlVersion)' ` -OutputDirectory $winmlDir ` -Source 'https://api.nuget.org/v3/index.json' ` -DependencyVersion Lowest ` @@ -121,8 +114,8 @@ steps: feed="https://www.nuget.org/api/v2/package" declare -a entries=( - "genai:Microsoft.ML.OnnxRuntimeGenAI.Foundry:${{ parameters.genaiVersion }}" - "ort:Microsoft.ML.OnnxRuntime:${{ parameters.ortVersion }}" + "genai:Microsoft.ML.OnnxRuntimeGenAI.Foundry:$(genaiVersion)" + "ort:Microsoft.ML.OnnxRuntime:$(ortVersion)" ) if [ "${{ parameters.includeWinml }}" = "True" ]; then # WinML is Windows-only; the bash branch should never receive includeWinml=true. @@ -132,7 +125,7 @@ steps: exit 1 fi if [ "${{ parameters.includeOrtGpuLinux }}" = "True" ]; then - entries+=("ort_gpu_linux:Microsoft.ML.OnnxRuntime.Gpu.Linux:${{ parameters.ortVersion }}") + entries+=("ort_gpu_linux:Microsoft.ML.OnnxRuntime.Gpu.Linux:$(ortVersion)") fi defines=() diff --git a/.pipelines/v2/templates/steps-read-deps-versions.yml b/.pipelines/v2/templates/steps-read-deps-versions.yml new file mode 100644 index 000000000..a65133003 --- /dev/null +++ b/.pipelines/v2/templates/steps-read-deps-versions.yml @@ -0,0 +1,54 @@ +# Reads sdk_v2/deps_versions.json and sets ortVersion, genaiVersion, and +# winmlVersion as job-level pipeline variables for use in subsequent steps. +# +# Must run after source checkout. Outputs: +# $(ortVersion) – Microsoft.ML.OnnxRuntime version +# $(genaiVersion) – Microsoft.ML.OnnxRuntimeGenAI.Foundry version +# $(winmlVersion) – Microsoft.WindowsAppSDK.ML version +# +# Parameters: +# shell – 'pwsh' (Windows) or 'bash' (Linux/macOS) + +parameters: +- name: shell + type: string + values: ['pwsh', 'bash'] + +steps: + +- ${{ if eq(parameters.shell, 'pwsh') }}: + - task: PowerShell@2 + displayName: 'Read versions from deps_versions.json' + inputs: + targetType: inline + pwsh: true + script: | + $depsFile = '$(Build.SourcesDirectory)/sdk_v2/deps_versions.json' + if (-not (Test-Path $depsFile)) { + throw "deps_versions.json not found at $depsFile" + } + $deps = Get-Content $depsFile -Raw | ConvertFrom-Json + $ortVer = $deps.onnxruntime.'version' + $genaiVer = $deps.'onnxruntime-genai'.'version' + $winmlVer = $deps.'winappsdk-ml'.'version' + Write-Host "ortVersion=$ortVer, genaiVersion=$genaiVer, winmlVersion=$winmlVer" + Write-Host "##vso[task.setvariable variable=ortVersion]$ortVer" + Write-Host "##vso[task.setvariable variable=genaiVersion]$genaiVer" + Write-Host "##vso[task.setvariable variable=winmlVersion]$winmlVer" + +- ${{ if eq(parameters.shell, 'bash') }}: + - bash: | + set -euo pipefail + depsFile="$(Build.SourcesDirectory)/sdk_v2/deps_versions.json" + if [ ! -f "$depsFile" ]; then + echo "ERROR: deps_versions.json not found at $depsFile" >&2 + exit 1 + fi + ortVer=$(python3 -c "import json; d=json.load(open('$depsFile')); print(d['onnxruntime']['version'])") + genaiVer=$(python3 -c "import json; d=json.load(open('$depsFile')); print(d['onnxruntime-genai']['version'])") + winmlVer=$(python3 -c "import json; d=json.load(open('$depsFile')); print(d['winappsdk-ml']['version'])") + echo "ortVersion=$ortVer, genaiVersion=$genaiVer, winmlVersion=$winmlVer" + echo "##vso[task.setvariable variable=ortVersion]$ortVer" + echo "##vso[task.setvariable variable=genaiVersion]$genaiVer" + echo "##vso[task.setvariable variable=winmlVersion]$winmlVer" + displayName: 'Read versions from deps_versions.json' diff --git a/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake b/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake index 7fb4eae67..72ac784ff 100644 --- a/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake +++ b/sdk_v2/cpp/cmake/FindOnnxRuntime.cmake @@ -80,14 +80,10 @@ else() # Standard path: FetchContent from nuget.org (releases) or ORT-Nightly ADO feed (dev builds) # ----------------------------------------------------------------------- if(NOT ORT_VERSION) - # Single source of truth: sdk_v2/deps_versions[_winml].json. The Python - # SDK build backend reads the same files so wheel deps and native ABI + # Single source of truth: sdk_v2/deps_versions.json. The Python + # SDK build backend reads the same file so wheel deps and native ABI # always agree. Override at the cmake command line with -DORT_VERSION=... - if(FOUNDRY_LOCAL_USE_WINML) - set(_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions_winml.json") - else() - set(_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions.json") - endif() + set(_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions.json") if(NOT EXISTS "${_DEPS_FILE}") message(FATAL_ERROR "Required versions file not found: ${_DEPS_FILE}") endif() diff --git a/sdk_v2/cpp/cmake/FindOnnxRuntimeGenAI.cmake b/sdk_v2/cpp/cmake/FindOnnxRuntimeGenAI.cmake index 4906c254b..ba6ad756c 100644 --- a/sdk_v2/cpp/cmake/FindOnnxRuntimeGenAI.cmake +++ b/sdk_v2/cpp/cmake/FindOnnxRuntimeGenAI.cmake @@ -1,10 +1,7 @@ # Copyright (c) Microsoft. All rights reserved. # Find/acquire ONNX Runtime GenAI. # -# Windows + FOUNDRY_LOCAL_USE_WINML=ON: Microsoft.ML.OnnxRuntimeGenAI.WinML -# Windows + FOUNDRY_LOCAL_USE_WINML=OFF: Microsoft.ML.OnnxRuntimeGenAI.Foundry -# Linux: Microsoft.ML.OnnxRuntimeGenAI.Foundry -# macOS: Microsoft.ML.OnnxRuntimeGenAI.Foundry +# All platforms: Microsoft.ML.OnnxRuntimeGenAI.Foundry # # When ORT_GENAI_HOME is set, uses the local ORT GenAI build instead of NuGet. # Otherwise uses FetchContent from nuget.org. @@ -111,14 +108,10 @@ else() endif() if(NOT ORT_GENAI_VERSION) - # Single source of truth: sdk_v2/deps_versions[_winml].json. The Python - # SDK build backend reads the same files. Override at the cmake command + # Single source of truth: sdk_v2/deps_versions.json. The Python + # SDK build backend reads the same file. Override at the cmake command # line with -DORT_GENAI_VERSION=... - if(FOUNDRY_LOCAL_USE_WINML) - set(_GENAI_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions_winml.json") - else() - set(_GENAI_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions.json") - endif() + set(_GENAI_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions.json") if(NOT EXISTS "${_GENAI_DEPS_FILE}") message(FATAL_ERROR "Required versions file not found: ${_GENAI_DEPS_FILE}") endif() diff --git a/sdk_v2/cpp/cmake/FindWinMLEpCatalog.cmake b/sdk_v2/cpp/cmake/FindWinMLEpCatalog.cmake index 2f83cf836..86cc5ac77 100644 --- a/sdk_v2/cpp/cmake/FindWinMLEpCatalog.cmake +++ b/sdk_v2/cpp/cmake/FindWinMLEpCatalog.cmake @@ -24,15 +24,16 @@ endif() # Latest stable Microsoft.WindowsAppSDK.ML 1.8.x on nuget.org. Anything older # than 1.8.2141 silently disables EP detection (no WinMLEpCatalog.h). -set(_WINML_EP_CATALOG_MIN_VERSION "1.8.2192") - -# WINML_EP_CATALOG_VERSION may be set explicitly; otherwise pick the minimum -# known-good version. We deliberately do NOT inherit WINML_SDK_VERSION here: -# the WinML SDK and the EP catalog package have independent compatibility -# requirements (the EP catalog ships only in newer WindowsAppSDK.ML packages, -# and our build no longer uses the WinML-bundled ORT regardless). +# Single source of truth: sdk_v2/deps_versions.json. Override at the cmake +# command line with -DWINML_EP_CATALOG_VERSION=... if(NOT WINML_EP_CATALOG_VERSION) - set(WINML_EP_CATALOG_VERSION "${_WINML_EP_CATALOG_MIN_VERSION}") + set(_DEPS_FILE "${CMAKE_CURRENT_LIST_DIR}/../../deps_versions.json") + if(NOT EXISTS "${_DEPS_FILE}") + message(FATAL_ERROR "Required versions file not found: ${_DEPS_FILE}") + endif() + file(READ "${_DEPS_FILE}" _DEPS_JSON) + string(JSON WINML_EP_CATALOG_VERSION GET "${_DEPS_JSON}" "winappsdk-ml" "version") + message(STATUS "WINML_EP_CATALOG_VERSION=${WINML_EP_CATALOG_VERSION} (from ${_DEPS_FILE})") endif() include(cmake/nuget.cmake) diff --git a/sdk_v2/deps_versions.json b/sdk_v2/deps_versions.json index ee73c5986..9649e250c 100644 --- a/sdk_v2/deps_versions.json +++ b/sdk_v2/deps_versions.json @@ -1,5 +1,6 @@ { - "_comment": "Single source of truth for ORT and ORT-GenAI versions in sdk_v2. Read by sdk_v2/cpp/cmake/FindOnnxRuntime*.cmake and sdk_v2/python/_build_backend/__init__.py.", + "_comment": "Single source of truth for ORT, ORT-GenAI, and WinML EP catalog versions in sdk_v2. Read by sdk_v2/cpp/cmake/FindOnnxRuntime*.cmake, FindWinMLEpCatalog.cmake, sdk_v2/python/_build_backend/__init__.py, and .pipelines/v2/templates/steps-read-deps-versions.yml.", "onnxruntime": { "version": "1.26.0" }, - "onnxruntime-genai": { "version": "0.14.0" } + "onnxruntime-genai": { "version": "0.14.0" }, + "winappsdk-ml": { "version": "1.8.2192" } } diff --git a/sdk_v2/deps_versions_winml.json b/sdk_v2/deps_versions_winml.json deleted file mode 100644 index 9203ee468..000000000 --- a/sdk_v2/deps_versions_winml.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "_comment": "WinML variant of sdk_v2/deps_versions.json. Selected by FOUNDRY_LOCAL_USE_WINML=ON (cmake) and FL_PYTHON_PACKAGE_NAME=foundry-local-sdk-winml (python build backend).", - "onnxruntime": { "version": "1.26.0" }, - "onnxruntime-genai": { "version": "0.14.0" } -} diff --git a/sdk_v2/python/_build_backend/__init__.py b/sdk_v2/python/_build_backend/__init__.py index d3bb42dd3..c33b896d2 100644 --- a/sdk_v2/python/_build_backend/__init__.py +++ b/sdk_v2/python/_build_backend/__init__.py @@ -3,10 +3,7 @@ # Delegates every hook to ``setuptools.build_meta``. The only added # behavior is a temporary patch of ``pyproject.toml`` when the # ``FL_PYTHON_PACKAGE_NAME`` environment variable is set, so the same -# source tree can produce two differently-named wheels: -# -# * unset -> foundry-local-sdk (default) -# * foundry-local-sdk-winml -> foundry-local-sdk-winml (WinML SKU) +# source tree can produce differently-named wheels. # # This is wired into pyproject.toml via:: # @@ -50,11 +47,9 @@ _ENV_VAR = "FL_PYTHON_PACKAGE_NAME" -_WINML_PKG_NAME = "foundry-local-sdk-winml" _PYPROJECT = Path(__file__).resolve().parent.parent / "pyproject.toml" _SDK_V2_ROOT = _PYPROJECT.resolve().parent.parent _DEPS_JSON_STD = _SDK_V2_ROOT / "deps_versions.json" -_DEPS_JSON_WINML = _SDK_V2_ROOT / "deps_versions_winml.json" # Match ``name = "..."`` only inside the [project] table. The regex is # anchored to the first ``name = "foundry-local-sdk"`` occurrence which @@ -108,13 +103,12 @@ def _patch_pyproject_text(original: str, *, override_name: str | None, deps_file def _maybe_patch_name() -> Generator[None, None, None]: """Context manager that rewrites pyproject.toml during PEP 517 hook execution. - Always rewrites ORT/GenAI version pins from the appropriate deps JSON + Always rewrites ORT/GenAI version pins from deps_versions.json (single source of truth). Conditionally rewrites the project name when - ``FL_PYTHON_PACKAGE_NAME`` selects the WinML variant. + ``FL_PYTHON_PACKAGE_NAME`` overrides the default. """ override = os.environ.get(_ENV_VAR, "").strip() or None - is_winml = override == _WINML_PKG_NAME - deps_file = _DEPS_JSON_WINML if is_winml else _DEPS_JSON_STD + deps_file = _DEPS_JSON_STD original = _PYPROJECT.read_text(encoding="utf-8") patched = _patch_pyproject_text(original, override_name=override, deps_file=deps_file) diff --git a/sdk_v2/python/pyproject.toml b/sdk_v2/python/pyproject.toml index cb8cf3d3e..b31bd7b7b 100644 --- a/sdk_v2/python/pyproject.toml +++ b/sdk_v2/python/pyproject.toml @@ -38,10 +38,9 @@ classifiers = [ ] # ORT/GenAI version pins below use sentinel ``0.0.0``. The real versions -# come from sdk_v2/deps_versions.json (or deps_versions_winml.json for the -# WinML variant) — the _build_backend rewrites these pins from JSON at -# wheel-build time. JSON is the single source of truth; bumping ORT -# versions is a one-file edit. +# come from sdk_v2/deps_versions.json — the _build_backend rewrites these +# pins from JSON at wheel-build time. JSON is the single source of truth; +# bumping ORT versions is a one-file edit. # # If a wheel ever ships with ``==0.0.0`` it means the backend wasn't # invoked (e.g. raw setuptools bypass) — pip install will fail loudly From 0ebb6f64e214980a9cbbac8513801f623482f228 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 8 Jun 2026 11:28:09 -0700 Subject: [PATCH 05/10] rmv --- .pipelines/v2/templates/steps-build-linux.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pipelines/v2/templates/steps-build-linux.yml b/.pipelines/v2/templates/steps-build-linux.yml index 081daa6a8..3b13e06d1 100644 --- a/.pipelines/v2/templates/steps-build-linux.yml +++ b/.pipelines/v2/templates/steps-build-linux.yml @@ -27,7 +27,6 @@ steps: - template: steps-prefetch-nuget.yml parameters: - winmlVersion: '' includeWinml: false includeOrtGpuLinux: true shell: bash From 200adc5831a40b2e92694b52d65975eb3045ae69 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 8 Jun 2026 11:29:11 -0700 Subject: [PATCH 06/10] rmv rmv --- .pipelines/v2/templates/steps-build-macos.yml | 1 - .pipelines/v2/templates/steps-build-windows.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.pipelines/v2/templates/steps-build-macos.yml b/.pipelines/v2/templates/steps-build-macos.yml index dbecb7f51..eac3cc1fb 100644 --- a/.pipelines/v2/templates/steps-build-macos.yml +++ b/.pipelines/v2/templates/steps-build-macos.yml @@ -36,7 +36,6 @@ steps: - template: steps-prefetch-nuget.yml parameters: - winmlVersion: '' includeWinml: false shell: bash diff --git a/.pipelines/v2/templates/steps-build-windows.yml b/.pipelines/v2/templates/steps-build-windows.yml index eaf46a30a..f9a58a763 100644 --- a/.pipelines/v2/templates/steps-build-windows.yml +++ b/.pipelines/v2/templates/steps-build-windows.yml @@ -54,7 +54,6 @@ steps: - template: steps-prefetch-nuget.yml parameters: - includeWinml: ${{ parameters.useWinml }} shell: pwsh # Bake the pipeline-computed version into the binary so FoundryLocalGetVersionString() From b077392b71ff9a096ca87cce7a07be67a7145c15 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Mon, 8 Jun 2026 14:07:07 -0700 Subject: [PATCH 07/10] macos symlink --- sdk_v2/cpp/CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sdk_v2/cpp/CMakeLists.txt b/sdk_v2/cpp/CMakeLists.txt index c203deec6..2670ba9f5 100644 --- a/sdk_v2/cpp/CMakeLists.txt +++ b/sdk_v2/cpp/CMakeLists.txt @@ -433,8 +433,12 @@ if(TARGET OnnxRuntime::OnnxRuntime) # macOS: copy dylibs so consumers that only link libfoundry_local.dylib (e.g. cache_only_tests) find the correct # ORT version instead of any system-installed ORT, which would cause an Ort::InitApi() version mismatch. # - # The ORT nupkg's libonnxruntime.dylib has LC_ID_DYLIB @rpath/libonnxruntime..dylib, so we copy it to - # the versioned filename that dependents (e.g. libonnxruntime-genai.dylib) look up via @rpath. + # The ORT nupkg's libonnxruntime.dylib has LC_ID_DYLIB @rpath/libonnxruntime.1.dylib (major version only, + # same pattern as libonnxruntime.so.1 on Linux). GenAI's LC_LOAD_DYLIB entry references that major-version + # name, so dyld looks for libonnxruntime.1.dylib at runtime. We must provide all three names: + # libonnxruntime.${ORT_VERSION}.dylib — the actual file (full version) + # libonnxruntime.1.dylib — major-version symlink (what dyld resolves via LC_LOAD_DYLIB) + # libonnxruntime.dylib — unversioned symlink (for -lonnxruntime at link time) add_custom_command(TARGET foundry_local POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ORT_GENAI_LIB_DIR}/libonnxruntime-genai.dylib" @@ -444,6 +448,13 @@ if(TARGET OnnxRuntime::OnnxRuntime) "$/libonnxruntime.${ORT_VERSION}.dylib" ) + # Major-version symlink — matches LC_ID_DYLIB / LC_LOAD_DYLIB embedded in libonnxruntime-genai.dylib. + add_custom_command(TARGET foundry_local POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink + libonnxruntime.${ORT_VERSION}.dylib + $/libonnxruntime.1.dylib + ) + # Conventional unversioned symlink so -lonnxruntime resolves at link time. add_custom_command(TARGET foundry_local POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink From dcf528986ce9c9077217d5313d9a991fe0874175 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Tue, 9 Jun 2026 13:15:00 -0700 Subject: [PATCH 08/10] macos fix --- sdk_v2/js/script/copy-native.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_v2/js/script/copy-native.mjs b/sdk_v2/js/script/copy-native.mjs index 8fcb05340..df059ca9d 100644 --- a/sdk_v2/js/script/copy-native.mjs +++ b/sdk_v2/js/script/copy-native.mjs @@ -59,7 +59,7 @@ const wanted = (() => { ]; } if (process.platform === "darwin") { - return ["libfoundry_local.dylib", "libonnxruntime.dylib", "libonnxruntime-genai.dylib"]; + return ["libfoundry_local.dylib", "libonnxruntime.dylib", "libonnxruntime.1.dylib", "libonnxruntime-genai.dylib"]; } return ["libfoundry_local.so", "libonnxruntime.so", "libonnxruntime.so.1", "libonnxruntime-genai.so"]; })(); From 2eeab2e90d25e23b522dfe3cac0bdc10a8c00d0f Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 10 Jun 2026 11:44:52 -0700 Subject: [PATCH 09/10] copy --- sdk_v2/js/script/copy-native.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_v2/js/script/copy-native.mjs b/sdk_v2/js/script/copy-native.mjs index 8fcb05340..df059ca9d 100644 --- a/sdk_v2/js/script/copy-native.mjs +++ b/sdk_v2/js/script/copy-native.mjs @@ -59,7 +59,7 @@ const wanted = (() => { ]; } if (process.platform === "darwin") { - return ["libfoundry_local.dylib", "libonnxruntime.dylib", "libonnxruntime-genai.dylib"]; + return ["libfoundry_local.dylib", "libonnxruntime.dylib", "libonnxruntime.1.dylib", "libonnxruntime-genai.dylib"]; } return ["libfoundry_local.so", "libonnxruntime.so", "libonnxruntime.so.1", "libonnxruntime-genai.so"]; })(); From c611d1176b1d8999ebbb03c7a3a98d73818e0174 Mon Sep 17 00:00:00 2001 From: Prathik Rao Date: Wed, 10 Jun 2026 16:31:37 -0700 Subject: [PATCH 10/10] pls --- sdk_v2/js/script/copy-native.mjs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sdk_v2/js/script/copy-native.mjs b/sdk_v2/js/script/copy-native.mjs index df059ca9d..cadc3789e 100644 --- a/sdk_v2/js/script/copy-native.mjs +++ b/sdk_v2/js/script/copy-native.mjs @@ -80,6 +80,24 @@ for (const file of wanted) { copied += 1; } +// macOS: the Microsoft.ML.OnnxRuntime package ships the file unversioned as +// libonnxruntime.dylib, but its install name (LC_ID_DYLIB) is the versioned +// @rpath/libonnxruntime.1.dylib. foundry_local (and onnxruntime-genai) therefore +// record a load-time dependency on libonnxruntime.1.dylib, which otherwise has no +// matching file on disk. Materialize the versioned alias next to the addon so the +// @rpath lookup resolves. (Linux gets the equivalent libonnxruntime.so.1 via a +// symlink created in FindOnnxRuntime.cmake; the macOS branch has no such symlink.) +if (process.platform === "darwin") { + const unversioned = resolve(destDir, "libonnxruntime.dylib"); + const versioned = resolve(destDir, "libonnxruntime.1.dylib"); + if (existsSync(unversioned) && !existsSync(versioned)) { + copyFileSync(unversioned, versioned); + const size = statSync(versioned).size; + console.log(`[copy-native] libonnxruntime.1.dylib (alias of libonnxruntime.dylib, ${size} bytes)`); + copied += 1; + } +} + if (copied === 0) { console.error(`[copy-native] No expected files found in ${sourceDir}`); process.exit(1);