Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] Using xnnpack fails with "_Float16 is not supported on this target" for iOS x86_64 simulator #22289

Closed
decamp opened this issue Oct 1, 2024 · 3 comments · Fixed by #22294
Labels
build build issues; typically submitted using template ep:Xnnpack issues related to XNNPACK EP platform:mobile issues related to ONNX Runtime mobile; typically submitted using template

Comments

@decamp
Copy link

decamp commented Oct 1, 2024

Describe the issue

When cross-compiling for iOS simulator x86_64, using the --use_xnnpack setting causes build to fail. It looks like maybe the build configuration is trying to rely on missing _Float16 support.

Build machine: M1 MacBook pro, MacOS 15.0
Xcode: 16.0
Clang: 16.0.0 (clang-1600.0.26.3)
Cmake: 3.30.4
onnxruntime: c24e55b1f140a2fc3d584738422313d436f122d6

Urgency

No response

Target platform

iOS x86_64 (simulator)

Build script

tools/ci_build/github/apple/build_and_assemble_apple_pods.py \
 --include-ops-by-config model.config \
 --build-settings-file build-settings.json

build-settings.json:

{
  "build_osx_archs": {
    "iphonesimulator": ["x86_64"]
  },
  "build_params": {
    "base": [
      "--parallel",
      "--build_apple_framework",
      "--use_coreml",
      "--skip_tests",
      "--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF"
    ],
    "iphonesimulator": [
      "--ios",
      "--use_xcode",
      "--use_xnnpack",
      "--apple_deploy_target=13.0"
    ]
  }
}

Error / output

PrecompileModule /Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/_math-EBU1MF3V4Y9NGBY750RC4B1Q2.scan
    cd /Users/name/code/vendor/onnxruntime/cmake
    builtin-precompileModule /Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/_math-EBU1MF3V4Y9NGBY750RC4B1Q2.scan
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -cc1 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fmessage-length\=295 -ferror-limit 19 -serialize-diagnostic-file /Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/_math-EBU1MF3V4Y9NGBY750RC4B1Q2.dia -fcolor-diagnostics -fsystem-module -fmodule-map-file\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/DarwinFoundation.modulemap -fmodule-map-file\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include/os_availability.modulemap -o /Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/_math-EBU1MF3V4Y9NGBY750RC4B1Q2.pcm -disable-free -emit-module -x c /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c_standard_library.modulemap -tune-cpu generic -target-cpu core2 -target-feature +sse -target-feature -sse2 -triple x86_64-apple-ios13.0.0-simulator -target-linker-version 1115.7.3 -target-sdk-version\=18.0 -fmodules-validate-system-headers -fno-modules-prune-non-affecting-module-map-files -fno-modulemap-allow-subdirectory-search -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16 -fmodule-file\=DarwinFoundation\=/Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/DarwinFoundation-6XBV9A52YVKP0OEUX88WZ9WT8.pcm -fmodule-file\=os_availability\=/Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/os_availability-7M09FJPGLX0VX34H2VI5UFU21.pcm -isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator18.0.sdk/usr/include -ivfsstatcache /var/folders/8t/7gch98kn3k15rj57hs17p9900000gn/C/com.apple.DeveloperTools/16.0-16A242d/Xcode/SDKStatCaches.noindex/iphonesimulator18.0-22A3362-db63dc9361471f152f572502bdbfe70a.sdkstatcache -std\=c99 -fasm-blocks -fmodules -fmodule-name\=_math -fmodules-search-all -fno-implicit-modules -fmax-type-align\=16 -mdarwin-stkchk-strong-link -fno-odr-hash-protocols -pic-level 2 -disable-objc-default-synthesize-properties -stack-protector 1 -fgnuc-version\=4.2.1 -fblocks -ffp-contract\=off -fclang-abi-compat\=4.0 -fno-experimental-relative-c++-abi-vtables -fno-file-reproducible -clang-vendor-feature\=+disableNonDependentMemberExprInCurrentInstantiation -clang-vendor-feature\=+enableAggressiveVLAFolding -clang-vendor-feature\=+revert09abecef7bbf -clang-vendor-feature\=+thisNoAlignAttr -clang-vendor-feature\=+thisNoNullAttr -clang-vendor-feature\=+disableAtImportPrivateFrameworkInImplementationError -O2 -fcommon -fno-sanitize-address-use-odr-indicator -fno-sanitize-memory-param-retval -fmerge-all-constants -fno-verbose-asm -fregister-global-dtors-with-atexit -fno-use-init-array -funique-basic-block-section-names -fsplit-dwarf-inlining -gno-codeview-command-line -gstrict-dwarf -gno-column-info -llvm-verify-each -no-struct-path-tbaa -fexperimental-assignment-tracking\=disabled -no-enable-noundef-analysis -stack-protector-buffer-size 0 -finline-functions -fno-unroll-loops -gpubnames -fdiagnostics-hotness-threshold\=0 -fdiagnostics-misexpect-tolerance\=0 -fno-split-cold-code -D CMAKE_INTDIR\=\"Release-iphonesimulator\" -D EIGEN_MPL2_ONLY -D FXDIV_USE_INLINE_ASSEMBLY\=0 -D NDEBUG -D ORT_ENABLE_STREAM -D REDUCED_OPS_BUILD -D XNN_ENABLE_ARM_BF16\=1 -D XNN_ENABLE_ARM_DOTPROD\=1 -D XNN_ENABLE_ARM_FP16_SCALAR\=1 -D XNN_ENABLE_ARM_FP16_VECTOR\=1 -D XNN_ENABLE_ARM_I8MM\=1 -D XNN_ENABLE_ASSEMBLY\=1 -D XNN_ENABLE_AVX256SKX\=1 -D XNN_ENABLE_AVX256VNNI\=1 -D XNN_ENABLE_AVX256VNNIGFNI\=1 -D XNN_ENABLE_AVX512AMX\=1 -D XNN_ENABLE_AVX512FP16\=1 -D XNN_ENABLE_AVX512VNNIGFNI\=1 -D XNN_ENABLE_AVXVNNI\=1 -D XNN_ENABLE_CPUINFO\=1 -D XNN_ENABLE_DWCONV_MULTIPASS\=0 -D XNN_ENABLE_GEMM_M_SPECIALIZATION\=1 -D XNN_ENABLE_HVX\=1 -D XNN_ENABLE_KLEIDIAI\=0 -D XNN_ENABLE_MEMOPT\=1 -D XNN_ENABLE_RISCV_VECTOR\=1 -D XNN_ENABLE_SPARSE\=1 -D XNN_ENABLE_VSX\=1 -D XNN_LOG_LEVEL\=0 -D __GCC_HAVE_DWARF2_CFI_ASM\=1 -MT moduledependenciestarget -dependency-file /Users/name/code/vendor/onnxruntime/build/apple_framework/intermediates/iphonesimulator_x86_64/Release/build/ExplicitPrecompiledModules/_math-EBU1MF3V4Y9NGBY750RC4B1Q2.d -skip-unused-modulemap-deps
While building module '_math':
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/math.h:614:27: error: _Float16 is not supported on this target
  614 | extern _Float16 __fabsf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
      |                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/math.h:614:8: error: _Float16 is not supported on this target
  614 | extern _Float16 __fabsf16(_Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/math.h:615:28: error: _Float16 is not supported on this target
  615 | extern _Float16 __hypotf16(_Float16, _Float16) __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
      |                            ^

And so on...

It might be relevant that: -D XNN_ENABLE_AVX512FP16\=1.

Visual Studio Version

No response

GCC / Compiler Version

No response

@decamp decamp added the build build issues; typically submitted using template label Oct 1, 2024
@github-actions github-actions bot added ep:Xnnpack issues related to XNNPACK EP platform:mobile issues related to ONNX Runtime mobile; typically submitted using template labels Oct 1, 2024
@skottmckay
Copy link
Contributor

Seems to be an XNNPACK issue. Not sure why no fix has been directly added there. We will look into it.

google/XNNPACK#6989

@skottmckay
Copy link
Contributor

I think Xcode 16 is also a factor. I don't see an issue with Xcode 14.7 cross-compiling on an M1.

@vraspar
Copy link
Contributor

vraspar commented Oct 2, 2024

It seems to be issue with FP16 dependency. I verified that this PR fixes the above issue: Maratyszcza/FP16#32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template ep:Xnnpack issues related to XNNPACK EP platform:mobile issues related to ONNX Runtime mobile; typically submitted using template
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants