diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 04b5fdb85ed56..25565db7c9499 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -110,7 +110,7 @@ jobs: --osx_arch=${{ matrix.target_arch }} Vcpkg: - runs-on: macos-13 + runs-on: macOS-14 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/cmake/CMakePresets.json b/cmake/CMakePresets.json index 4987edaf85513..8d63912f6eaee 100644 --- a/cmake/CMakePresets.json +++ b/cmake/CMakePresets.json @@ -109,6 +109,29 @@ "rhs": "Darwin" } }, + { + "name": "arm64-osx", + "inherits": [ + "unit-test" + ], + "generator": "Xcode", + "binaryDir": "${sourceParentDir}/cmake_build/arm64-osx", + "installDir": "${sourceParentDir}/cmake_build/out", + "cacheVariables": { + "CMAKE_OSX_ARCHITECTURES": "arm64", + "onnxruntime_BUILD_SHARED_LIB": true, + "onnxruntime_USE_XNNPACK": false, + "onnxruntime_USE_COREML": true, + "onnxruntime_BUILD_OBJC": true, + "onnxruntime_BUILD_APPLE_FRAMEWORK": true, + "CMAKE_CONFIGURATION_TYPES": "Debug;Release" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, { "name": "x64-osx-vcpkg", "inherits": [ diff --git a/onnxruntime/core/providers/coreml/model/host_utils.h b/onnxruntime/core/providers/coreml/model/host_utils.h index 145c64e5320d3..5507adb3ca828 100644 --- a/onnxruntime/core/providers/coreml/model/host_utils.h +++ b/onnxruntime/core/providers/coreml/model/host_utils.h @@ -43,6 +43,10 @@ #define API_AVAILABLE_COREML7 API_AVAILABLE(macos(14), ios(17)) #define API_AVAILABLE_COREML8 API_AVAILABLE(macos(15), ios(18)) +// The previous macros are used in header files to declare the availability of the APIs. +// The following macros are used in implementation files to check the availability of the APIs. +#define CAN_USE_COREML8_OR_LATER (__MAC_OS_X_VERSION_MAX_ALLOWED >= 150000 && __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000) + // @available is used in implementation code // Base required OS to run CoreML Specification Version 4 (Core ML 3) #define HAS_COREML3_OR_LATER @available(macOS 10.15, iOS 13, *) diff --git a/onnxruntime/core/providers/coreml/model/model.mm b/onnxruntime/core/providers/coreml/model/model.mm index 5211b89ec17c6..c140097f7bd66 100644 --- a/onnxruntime/core/providers/coreml/model/model.mm +++ b/onnxruntime/core/providers/coreml/model/model.mm @@ -369,9 +369,8 @@ void ProfileComputePlan(NSURL* compileUrl, MLModelConfiguration* config) { #define HAS_COREMLOPTIMIZATIONHINT 0 #endif -API_AVAILABLE_COREML8 void ConfigureOptimizationHints(MLModelConfiguration* config, const CoreMLOptions& coreml_options) { -#if HAS_COREMLOPTIMIZATIONHINT +#if HAS_COREMLOPTIMIZATIONHINT && CAN_USE_COREML8_OR_LATER MLOptimizationHints* optimizationHints = [[MLOptimizationHints alloc] init]; if (coreml_options.UseStrategy("FastPrediction")) { optimizationHints.specializationStrategy = MLSpecializationStrategyFastPrediction; diff --git a/tools/ci_build/github/azure-pipelines/mac-coreml-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-coreml-ci-pipeline.yml index a1059bb3c314e..4e83b6992ae91 100644 --- a/tools/ci_build/github/azure-pipelines/mac-coreml-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-coreml-ci-pipeline.yml @@ -33,7 +33,7 @@ jobs: workspace: clean: all pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: MACOSX_DEPLOYMENT_TARGET: '13.3' TODAY: $[format('{0:dd}{0:MM}{0:yyyy}', pipeline.startTime)] diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml index 26b072ed55b04..5a8b916ec82a4 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-ci-pipeline.yml @@ -31,7 +31,7 @@ pr: jobs: - job: iOS_CI_on_Mac pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: PROTO_CACHE_DIR: $(Pipeline.Workspace)/proto_ccache ORT_CACHE_DIR: $(Pipeline.Workspace)/ort_ccache @@ -39,7 +39,7 @@ jobs: # Note: Keep the Xcode version and iOS simulator version compatible. # Check the table here to see what iOS simulator versions are supported by a particular Xcode version: # https://developer.apple.com/support/xcode/ - XCODE_VERSION: 14.3.1 + XCODE_VERSION: 15.3.0 IOS_SIMULATOR_RUNTIME_VERSION: 16.4 timeoutInMinutes: 150 steps: diff --git a/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml index c3176ec54fd79..9158e46dcbd8a 100644 --- a/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml @@ -54,7 +54,7 @@ stages: displayName: "Set common variables" pool: - vmImage: "macOS-13" + vmImage: "macOS-14" timeoutInMinutes: 5 diff --git a/tools/ci_build/github/azure-pipelines/nodejs/templates/test_macos.yml b/tools/ci_build/github/azure-pipelines/nodejs/templates/test_macos.yml index 4518a168879a2..a2a0e3bcace9f 100644 --- a/tools/ci_build/github/azure-pipelines/nodejs/templates/test_macos.yml +++ b/tools/ci_build/github/azure-pipelines/nodejs/templates/test_macos.yml @@ -11,7 +11,7 @@ stages: clean: all timeoutInMinutes: 120 pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: - name: OnnxRuntimeBuildDirectory diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml index 07d21333270a8..a6e38d0bc93f3 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/test_macos.yml @@ -11,7 +11,7 @@ stages: workspace: clean: all pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: - name: OnnxRuntimeBuildDirectory diff --git a/tools/ci_build/github/azure-pipelines/post-merge-jobs.yml b/tools/ci_build/github/azure-pipelines/post-merge-jobs.yml index 7dc6ec5747acf..69d495557ab95 100644 --- a/tools/ci_build/github/azure-pipelines/post-merge-jobs.yml +++ b/tools/ci_build/github/azure-pipelines/post-merge-jobs.yml @@ -423,7 +423,7 @@ stages: - job: IosDynamicFramework timeoutInMinutes: 120 pool: - vmImage: "macOS-13" + vmImage: "macOS-14" steps: - task: UsePythonVersion@0 @@ -459,7 +459,7 @@ stages: - job: IosMinimalTrainingBuild timeoutInMinutes: 120 pool: - vmImage: "macOS-13" + vmImage: "macOS-14" steps: - task: UsePythonVersion@0 diff --git a/tools/ci_build/github/azure-pipelines/py-package-test-pipeline.yml b/tools/ci_build/github/azure-pipelines/py-package-test-pipeline.yml index a0e49692220f9..7a977b5fc5c15 100644 --- a/tools/ci_build/github/azure-pipelines/py-package-test-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/py-package-test-pipeline.yml @@ -29,7 +29,7 @@ stages: parameters: job_name: Test_MAC_Wheels machine_pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' itemPattern: '*/*mac*x86_64.whl' - template: templates/py-package-smoking-test.yml parameters: diff --git a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml index 665a11c64e873..b94e004d79599 100644 --- a/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml +++ b/tools/ci_build/github/azure-pipelines/stages/py-cpu-packaging-stage.yml @@ -240,7 +240,7 @@ stages: workspace: clean: all pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: MACOSX_DEPLOYMENT_TARGET: '13.3' strategy: diff --git a/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml b/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml index 7b378f5c8c474..24832c5aa091b 100644 --- a/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml +++ b/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml @@ -29,7 +29,7 @@ jobs: workspace: clean: all pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: - name: runCodesignValidationInjection value: false diff --git a/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml b/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml index f5350483ff144..da5888a3beb1e 100644 --- a/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml +++ b/tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml @@ -119,7 +119,7 @@ stages: workspace: clean: all pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' timeoutInMinutes: 300 steps: - template: set-version-number-variables-step.yml @@ -816,7 +816,7 @@ stages: - template: ../nuget/templates/test_macos.yml parameters: - AgentPool : macOS-13 + AgentPool : macOS-14 ArtifactSuffix: 'CPU' - template: ../nodejs/templates/test_win.yml @@ -852,4 +852,4 @@ stages: OS: MacOS BuildId: ${{ parameters.BuildId }} SpecificArtifact: ${{ parameters.SpecificArtifact }} - PoolName: 'macOS-13' + PoolName: 'macOS-14' diff --git a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-pipeline.yml b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-pipeline.yml index ab31e592d7d71..8c725c1d6b9a0 100644 --- a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-pipeline.yml @@ -68,7 +68,7 @@ stages: jobs: - job: MacOS_C_API_Package_Publish pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' steps: - checkout: none - template: flex-downloadPipelineArtifact.yml diff --git a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml index 7a1addffee0e3..f5ac2f6925d43 100644 --- a/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml +++ b/tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml @@ -37,7 +37,7 @@ jobs: PROTO_CACHE_DIR: $(Pipeline.Workspace)/ccache_proto ORT_CACHE_DIR: $(Pipeline.Workspace)/ccache_ort pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' timeoutInMinutes: 300 steps: - checkout: self diff --git a/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml b/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml index f4d00c274030c..47b5b2619d252 100644 --- a/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml +++ b/tools/ci_build/github/azure-pipelines/templates/react-native-ci.yml @@ -46,7 +46,7 @@ stages: - job: Build_Ios_Pod_For_React_Native pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' timeoutInMinutes: 90 @@ -103,7 +103,7 @@ stages: jobs: - job: ReactNative_CI pool: - vmImage: 'macOS-13' + vmImage: 'macOS-14' variables: runCodesignValidationInjection: false timeoutInMinutes: 90 diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 5d7ea5e7b2727..89cd95d4d68f1 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -15,13 +15,13 @@ stages: displayName: "Build iOS package for variant: ${{ parameters.packageVariant}}" pool: - vmImage: "macOS-13" + vmImage: "macOS-14" variables: # Note: Keep the Xcode version and iOS simulator version compatible. # Check the table here to see what iOS simulator versions are supported by a particular Xcode version: # https://developer.apple.com/support/xcode/ - xcodeVersion: "14.3.1" + xcodeVersion: "15.3.0" iosSimulatorRuntimeVersion: "16.4" ortPodVersion: $[stageDependencies.IosPackaging_SetCommonVariables.j.outputs['SetCommonVariables.ORT_POD_VERSION']] diff --git a/tools/ci_build/github/azure-pipelines/templates/use-xcode-version.yml b/tools/ci_build/github/azure-pipelines/templates/use-xcode-version.yml index 2cf698aefa8bd..3c1bfcd60fedd 100644 --- a/tools/ci_build/github/azure-pipelines/templates/use-xcode-version.yml +++ b/tools/ci_build/github/azure-pipelines/templates/use-xcode-version.yml @@ -3,7 +3,7 @@ parameters: - name: xcodeVersion type: string - default: "14.3.1" + default: "15.3.0" steps: - bash: |