From 2eb900a267cdb737eef5d65131e9e3e65eea0902 Mon Sep 17 00:00:00 2001 From: Jian Chen Date: Fri, 10 Jan 2025 14:37:53 -0800 Subject: [PATCH] Adding preprocessor define for checking CAN_USE_COREML8_OR_LATER --- onnxruntime/core/providers/coreml/model/model.mm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/onnxruntime/core/providers/coreml/model/model.mm b/onnxruntime/core/providers/coreml/model/model.mm index fff1c231f9..10c6f1a9b8 100644 --- a/onnxruntime/core/providers/coreml/model/model.mm +++ b/onnxruntime/core/providers/coreml/model/model.mm @@ -369,10 +369,8 @@ void ProfileComputePlan(NSURL* compileUrl, MLModelConfiguration* config) { #define HAS_COREMLOPTIMIZATIONHINT 0 #endif - void ConfigureOptimizationHints(MLModelConfiguration* config, const CoreMLOptions& coreml_options) { - if (HAS_COREML8_OR_LATER) { -#if HAS_COREMLOPTIMIZATIONHINT +#if HAS_COREMLOPTIMIZATIONHINT && CAN_USE_COREML8_OR_LATER MLOptimizationHints* optimizationHints = [[MLOptimizationHints alloc] init]; if (coreml_options.UseStrategy("FastPrediction")) { optimizationHints.specializationStrategy = MLSpecializationStrategyFastPrediction; @@ -384,7 +382,6 @@ void ConfigureOptimizationHints(MLModelConfiguration* config, const CoreMLOption // not set } #endif - } } Status CompileOrReadCachedModel(NSURL* modelUrl, const CoreMLOptions& coreml_options,