Skip to content

Commit

Permalink
Add comments for clang version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wejoncy authored Dec 9, 2024
1 parent 17d2c4d commit 2bc621f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions onnxruntime/core/providers/coreml/model/model.mm
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ Status GetMLMultiArrayCopyInfo(const MLMultiArray* _Nonnull array,
}

// since __clang_major__ >= 15, MLComputePlan is introduced in <CoreML/CoreML.h>
// We are actually ensure the MacOS/IOS version and Xcode version is greater than `macOS 14.4, iOS 17.4`.
// Otherwise, the compiler will complain `MLComputePlan` is not defined.
// we define __clang_analyzer__ here is for bypass static analysis
void ProfileComputePlan(NSURL* compileUrl, MLModelConfiguration* config) {
#if defined(__APPLE__) && defined(__clang__) && __clang_major__ >= 15 && !defined(__clang_analyzer__)
Expand Down Expand Up @@ -457,6 +459,7 @@ Status Predict(const std::unordered_map<std::string, OnnxTensorData>& inputs,

// Set the specialization strategy to FastPrediction for macOS 10.15+
// since __clang_major__ >= 15, optimizationHints is introduced in <CoreML/CoreML.h>
// Same as above comments for why we are checking __clang_major__.
// we define __clang_analyzer__ here is for bypass static analysis
#if defined(__APPLE__) && defined(__clang__) && __clang_major__ >= 15 && !defined(__clang_analyzer__)
if (HAS_COREML8_OR_LATER) {
Expand Down

0 comments on commit 2bc621f

Please sign in to comment.