merge with main

This commit is contained in:
Jian Chen 2025-01-09 13:00:21 -08:00
parent 2058317922
commit 09f793fe6f
3 changed files with 39 additions and 19 deletions

View file

@ -1,7 +1,7 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
platform :ios, '15.1'
pre_install do |installer|
# Custom pre-install script or commands
@ -15,7 +15,14 @@ end
target 'OnnxruntimeModuleExample' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
]# Check both symbol and string keys with default value
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => false
)
use_frameworks!
@ -32,7 +39,10 @@ post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
# TODO: remove this once we migrate the Pipelines to use arm64 MacOS
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
end
end
end

View file

@ -1,7 +1,7 @@
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
platform :ios, '15.1'
pre_install do |installer|
# Custom pre-install script or commands
@ -15,8 +15,14 @@ end
def shared
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# Check both symbol and string keys with default value
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => false
)
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
@ -43,8 +49,10 @@ post_install do |installer|
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
# TODO: remove this once we migrate the Pipelines to use arm64 MacOS
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
end
end
end
end
end

View file

@ -369,20 +369,22 @@ void ProfileComputePlan(NSURL* compileUrl, MLModelConfiguration* config) {
#define HAS_COREMLOPTIMIZATIONHINT 0
#endif
API_AVAILABLE_COREML8
void ConfigureOptimizationHints(MLModelConfiguration* config, const CoreMLOptions& coreml_options) {
if (HAS_COREML8_OR_LATER) {
#if HAS_COREMLOPTIMIZATIONHINT
MLOptimizationHints* optimizationHints = [[MLOptimizationHints alloc] init];
if (coreml_options.UseStrategy("FastPrediction")) {
optimizationHints.specializationStrategy = MLSpecializationStrategyFastPrediction;
config.optimizationHints = optimizationHints;
} else if (coreml_options.UseStrategy("Default")) {
optimizationHints.specializationStrategy = MLSpecializationStrategyDefault;
config.optimizationHints = optimizationHints;
} else {
// not set
}
MLOptimizationHints* optimizationHints = [[MLOptimizationHints alloc] init];
if (coreml_options.UseStrategy("FastPrediction")) {
optimizationHints.specializationStrategy = MLSpecializationStrategyFastPrediction;
config.optimizationHints = optimizationHints;
} else if (coreml_options.UseStrategy("Default")) {
optimizationHints.specializationStrategy = MLSpecializationStrategyDefault;
config.optimizationHints = optimizationHints;
} else {
// not set
}
#endif
}
}
Status CompileOrReadCachedModel(NSURL* modelUrl, const CoreMLOptions& coreml_options,