Skip to content

Commit 7f4a15b

Browse files
edgchen1Copilot
andauthored
[plugin-ep-webgpu/rel-0.2] WebGPU plugin EP 0.2.1 cherry-picks (#29925)
This cherry-picks the following commits for the release: | Commit ID | PR Number | Commit Title | |-----------|-----------|-------------| | bb9ba7e | #29468 | Upgrade to Xcode 26 | Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e670c98 commit 7f4a15b

13 files changed

Lines changed: 118 additions & 44 deletions

.github/workflows/ios.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ concurrency:
1717

1818
jobs:
1919
iOS_CI_on_Mac:
20-
runs-on: macos-14
20+
runs-on: macos-15
2121
steps:
2222
- name: Checkout repository
2323
uses: actions/checkout@v6
@@ -38,7 +38,7 @@ jobs:
3838
XCODE_DEVELOPER_DIR="/Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer"
3939
sudo xcode-select --switch "${XCODE_DEVELOPER_DIR}"
4040
41-
- name: (CPU, CoreML, XNNPACK EPs) Build onnxruntime for iOS x86_64 and run tests using simulator
41+
- name: (CPU, CoreML, XNNPACK EPs) Build onnxruntime for iOS and run tests using simulator
4242
shell: bash
4343
run: |
4444
python3 ${{ github.workspace }}/tools/ci_build/build.py \
@@ -49,7 +49,7 @@ jobs:
4949
--use_xnnpack \
5050
--ios \
5151
--apple_sysroot iphonesimulator \
52-
--osx_arch x86_64 \
52+
--osx_arch arm64 \
5353
--apple_deploy_target=15.1 \
5454
--use_xcode \
5555
--config RelWithDebInfo \
@@ -61,5 +61,5 @@ jobs:
6161

6262
timeout-minutes: 150
6363
env:
64-
XCODE_VERSION: 15.3.0
65-
IOS_SIMULATOR_RUNTIME_VERSION: 17.4
64+
XCODE_VERSION: 26.3
65+
IOS_SIMULATOR_RUNTIME_VERSION: 26.2

.github/workflows/mac.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ jobs:
2323
uses: ./.github/workflows/macos-ci-build-and-test-workflow.yml
2424
with:
2525
# Only build arm64 for CPU
26+
# Also run a Release build on Xcode 16 for legacy-toolchain coverage.
2627
matrix_include: >-
2728
[
2829
{"machine": "arm64", "target": "arm64", "build_config": "Debug"},
29-
{"machine": "arm64", "target": "arm64", "build_config": "Release"}
30+
{"machine": "arm64", "target": "arm64", "build_config": "Release"},
31+
{"machine": "arm64", "target": "arm64", "build_config": "Release", "xcode_version": "16"}
3032
]
3133
python_version: "3.14"
3234

@@ -69,8 +71,8 @@ jobs:
6971
runs-on: macos-15
7072

7173
env:
72-
xcode_version: 16.4
73-
simulator_runtime_version: 18.5
74+
xcode_version: 26.3
75+
simulator_runtime_version: 26.2
7476

7577
strategy:
7678
matrix:

.github/workflows/macos-ci-build-and-test-workflow.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
#
4949
include: ${{ fromJSON(inputs.matrix_include) }}
5050

51-
# "macos-13" is a x86_64 image, and "macos-15" is an arm64 image.
51+
# "macos-15" is an arm64 image.
5252
# see also: https://github.com/actions/runner-images/blob/main/README.md
53-
runs-on: ${{ matrix.machine == 'x86_64' && 'macos-13' || 'macos-15' }}
53+
runs-on: ${{ matrix.machine == 'x86_64' && 'macos-15-intel' || 'macos-15' }}
5454
env:
5555
build_flags: >
5656
--build_dir ./build
@@ -70,8 +70,9 @@ jobs:
7070
--config ${{ matrix.build_config }}
7171
--osx_arch ${{ matrix.target }}
7272
73-
# xCode version needs to match the "runs-on" configuration.
74-
xcode_version: ${{ matrix.machine == 'x86_64' && '14.3.1' || '16' }}
73+
# A matrix entry may override the Xcode version via "xcode_version"; otherwise fall back to the default.
74+
# The Xcode version needs to be present on the image specified in the "runs-on" configuration.
75+
xcode_version: ${{ matrix.xcode_version || '26.3' }}
7576

7677
steps:
7778
- name: Checkout code

cmake/onnxruntime.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,18 @@ if(onnxruntime_BUILD_APPLE_FRAMEWORK)
400400
# vs. onnxruntime/providers/core/cpu/math/element_wise_ops.o)
401401
# In that case, using 'ar ARGS -x' to extract the .o files from .a lib would possibly cause duplicate naming files being overwritten
402402
# and lead to missing undefined symbol error in the generated binary.
403-
# So we use the below python script as a sanity check to do a recursive find of all .o files in ${CUR_TARGET_CMAKE_SOURCE_LIB_DIR}
403+
# So we use the below python script as a sanity check to do a recursive find of all .o files in ${CUR_TARGET_OBJECT_DIR}
404404
# and verifies that matches the content of the .a, and then copy from the source dir.
405405
# TODO: The copying action here isn't really necessary. For future fix, consider using the script extracts from the ar with the rename to potentially
406406
# make both maccatalyst and other builds do the same thing.
407-
set(CUR_TARGET_CMAKE_SOURCE_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_LIB}.dir)
407+
408+
# Use the target's own BINARY_DIR: targets added via add_subdirectory (e.g. model_package) put their
409+
# objects under a nested CMakeFiles/<lib>.dir, not one directly under CMAKE_CURRENT_BINARY_DIR.
410+
get_target_property(_LIB_BINARY_DIR ${_LIB} BINARY_DIR)
411+
set(CUR_TARGET_OBJECT_DIR ${_LIB_BINARY_DIR}/CMakeFiles/${_LIB}.dir)
408412
add_custom_command(TARGET onnxruntime POST_BUILD
409413
COMMAND /usr/bin/ar -t $<TARGET_FILE:${_LIB}> | grep "\.o$" > ${_LIB}.object_file_list.txt
410-
COMMAND ${CMAKE_COMMAND} -E env python3 ${CMAKE_CURRENT_SOURCE_DIR}/maccatalyst_prepare_objects_for_prelink.py ${CUR_TARGET_CMAKE_SOURCE_LIB_DIR} ${CUR_STATIC_LIB_OBJ_DIR} ${CUR_STATIC_LIB_OBJ_DIR}/${_LIB}.object_file_list.txt
414+
COMMAND ${CMAKE_COMMAND} -E env python3 ${CMAKE_CURRENT_SOURCE_DIR}/maccatalyst_prepare_objects_for_prelink.py ${CUR_TARGET_OBJECT_DIR} ${CUR_STATIC_LIB_OBJ_DIR} ${CUR_STATIC_LIB_OBJ_DIR}/${_LIB}.object_file_list.txt
411415
WORKING_DIRECTORY ${CUR_STATIC_LIB_OBJ_DIR})
412416
else()
413417
add_custom_command(TARGET onnxruntime POST_BUILD

cmake/patches/xnnpack/AddEmscriptenAndIosSupport.patch

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,23 @@ index 94bcad92e3..be7dfe95fd 100644
4040
SET_PROPERTY(SOURCE ${ALL_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -marm ")
4141
- SET_PROPERTY(SOURCE ${ALL_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv6 -mfpu=vfp -munaligned-access ")
4242
+ # set this to armv7-a to workaround build issue. we don't target armv6 so it shouldn't matter
43-
+ SET_PROPERTY(SOURCE ${ALL_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=vfp -munaligned-access ")
43+
+ SET_PROPERTY(SOURCE ${ALL_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=vfp -munaligned-access ")
4444
SET_PROPERTY(SOURCE ${ALL_NEON_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon ")
4545
SET_PROPERTY(SOURCE ${ALL_NEONFP16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon-fp16 ")
4646
# GCC requires -mfp16-format=ieee to define __fp16 type, but Clang doesn't support this option at all.
47+
@@ -1038,7 +1047,14 @@ IF(XNNPACK_TARGET_PROCESSOR MATCHES "^x86(_64)?$")
48+
SET_PROPERTY(SOURCE ${ALL_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -fomit-frame-pointer ")
49+
ENDIF()
50+
ENDIF()
51+
- SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse -mno-sse2 ")
52+
+ # ORT: x86_64 always has SSE2, and the iOS 18+/macOS 15+ SDK <math.h> declares
53+
+ # _Float16 (which clang supports only with SSE2). Building the SSE microkernels with
54+
+ # -mno-sse2 then breaks the system math module precompile on Apple x86_64; keep SSE2.
55+
+ IF(APPLE AND XNNPACK_TARGET_PROCESSOR STREQUAL "x86_64")
56+
+ SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse2 -mno-sse3 ")
57+
+ ELSE()
58+
+ SET_PROPERTY(SOURCE ${ALL_SSE_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse -mno-sse2 ")
59+
+ ENDIF()
60+
SET_PROPERTY(SOURCE ${ALL_SSE2_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse2 -mno-sse3 ")
61+
SET_PROPERTY(SOURCE ${ALL_SSSE3_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -mssse3 -mno-sse4.1 ")
62+
SET_PROPERTY(SOURCE ${ALL_SSE41_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -msse4.1 -mno-sse4.2 ")

tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ extends:
6767
- template: templates/stages/mac-ios-packaging-build-stage.yml
6868
parameters:
6969
buildType: ${{ parameters.buildType }}
70-
xcodeVersion: "16.4"
71-
iosSimulatorRuntimeVersion: "18.5"
70+
xcodeVersion: "26.3"
71+
iosSimulatorRuntimeVersion: "26.2"

tools/ci_build/github/azure-pipelines/post-merge-jobs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ stages:
436436
architecture: 'x64'
437437

438438
- template: templates/use-xcode-version.yml
439+
parameters:
440+
xcodeVersion: 15.3.0
439441

440442
- script: |
441443
pip install -r tools/ci_build/github/apple/ios_packaging/requirements.txt

tools/ci_build/github/azure-pipelines/stages/plugin-mac-webgpu-stage.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ stages:
4343
submodules: none
4444

4545
- template: ../templates/use-xcode-version.yml
46-
parameters:
47-
xcodeVersion: '16.4'
4846

4947
- template: ../templates/setup-build-tools.yml
5048
parameters:

tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml

Lines changed: 71 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ stages:
102102

103103
- stage: iOS_Full_xcframework
104104
dependsOn: []
105+
variables:
106+
xcodeVersion: "26.3"
107+
iosSimulatorRuntimeVersion: "26.2"
105108
jobs:
106109
- job: iOS_Full_xcframework
107110
workspace:
@@ -118,7 +121,7 @@ stages:
118121

119122
- template: use-xcode-version.yml
120123
parameters:
121-
xcodeVersion: 16.4
124+
xcodeVersion: ${{ variables.xcodeVersion }}
122125

123126
- template: setup-build-tools.yml
124127
parameters:
@@ -129,25 +132,82 @@ stages:
129132
python3 tools/ci_build/github/apple/build_apple_framework.py \
130133
--build_dir "$(Build.BinariesDirectory)/ios_framework" \
131134
tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
132-
mkdir $(Build.BinariesDirectory)/artifacts
135+
displayName: "Build Apple xcframework"
136+
137+
- script: |
138+
set -e -x
139+
140+
# Stage onnxruntime.xcframework as artifact.
141+
mkdir -p $(Build.BinariesDirectory)/artifacts/xcframework
142+
133143
pushd $(Build.BinariesDirectory)/ios_framework/framework_out
134-
zip -vry $(Build.BinariesDirectory)/artifacts/onnxruntime_ios_xcframework.$(OnnxRuntimeVersion).zip \
144+
zip -vry $(Build.BinariesDirectory)/artifacts/xcframework/onnxruntime_ios_xcframework.$(OnnxRuntimeVersion).zip \
135145
onnxruntime.xcframework
136146
popd
137-
displayName: "Build Apple xcframework"
147+
148+
# Stage framework_out and xcframework_info.json as test artifact.
149+
# Note: framework_out has another copy of onnxruntime.xcframework. This duplication is simpler than
150+
# reconstructing the test files from two separate pipeline artifacts.
151+
mkdir -p $(Build.BinariesDirectory)/artifacts/test
152+
153+
pushd $(Build.BinariesDirectory)/ios_framework
154+
zip -vry $(Build.BinariesDirectory)/artifacts/test/test_files.zip \
155+
framework_out xcframework_info.json
156+
popd
157+
displayName: "Stage artifacts"
158+
159+
- task: 1ES.PublishPipelineArtifact@1
160+
inputs:
161+
targetPath: '$(Build.BinariesDirectory)/artifacts/xcframework'
162+
artifactName: 'onnxruntime-ios-full-xcframework'
163+
164+
- task: 1ES.PublishPipelineArtifact@1
165+
inputs:
166+
targetPath: '$(Build.BinariesDirectory)/artifacts/test'
167+
artifactName: 'onnxruntime-ios-full-xcframework-test'
168+
169+
# Run the framework test on a Microsoft-hosted macOS image, which has the required iOS simulator runtime.
170+
# The build above stays on the faster ACES pool; only this lighter test job uses the hosted image.
171+
# It consumes the onnxruntime-ios-full-xcframework-test artifact published by the build job.
172+
- job: iOS_Full_xcframework_test
173+
dependsOn: iOS_Full_xcframework
174+
workspace:
175+
clean: all
176+
pool:
177+
name: "Azure Pipelines"
178+
image: "macOS-15"
179+
os: macOS
180+
timeoutInMinutes: 90
181+
templateContext:
182+
inputs:
183+
- input: pipelineArtifact
184+
artifactName: 'onnxruntime-ios-full-xcframework-test'
185+
targetPath: '$(Build.BinariesDirectory)/artifacts/test'
186+
steps:
187+
- checkout: self
188+
189+
- template: use-xcode-version.yml
190+
parameters:
191+
xcodeVersion: ${{ variables.xcodeVersion }}
192+
193+
- template: setup-build-tools.yml
194+
parameters:
195+
host_cpu_arch: arm64
196+
197+
- script: |
198+
set -e -x
199+
unzip "$(Build.BinariesDirectory)/artifacts/test/test_files.zip" -d "$(Build.BinariesDirectory)"
200+
displayName: "Extract test files"
138201
139202
- script: |
140203
python3 tools/ci_build/github/apple/test_apple_packages.py \
141-
--framework_info_file "$(Build.BinariesDirectory)/ios_framework/xcframework_info.json" \
142-
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework/framework_out" \
204+
--framework_info_file "$(Build.BinariesDirectory)/xcframework_info.json" \
205+
--c_framework_dir "$(Build.BinariesDirectory)/framework_out" \
143206
--skip_macos_test \
144207
--mac_catalyst_enabled
145208
displayName: "Test Apple framework"
146-
147-
- task: 1ES.PublishPipelineArtifact@1
148-
inputs:
149-
targetPath: '$(Build.BinariesDirectory)/artifacts'
150-
artifactName: 'onnxruntime-ios-full-xcframework'
209+
env:
210+
ORT_GET_SIMULATOR_DEVICE_INFO_REQUESTED_RUNTIME_VERSION: ${{ variables.iosSimulatorRuntimeVersion }}
151211
152212
- template: win-ci.yml
153213
parameters:

tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232
submodules: none
3333

3434
- template: use-xcode-version.yml
35-
parameters:
36-
xcodeVersion: 16.4
3735

3836
- template: setup-build-tools.yml
3937
parameters:

0 commit comments

Comments
 (0)