diff --git a/O/ONNXRuntime/bundled/patches/aarch64-linux-bfloat16-float16-cmake.patch b/O/ONNXRuntime/bundled/patches/aarch64-linux-bfloat16-float16-cmake.patch new file mode 100644 index 00000000000..0fab8727248 --- /dev/null +++ b/O/ONNXRuntime/bundled/patches/aarch64-linux-bfloat16-float16-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt +index 5555fa692e..db6d3195ea 100644 +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -671,16 +671,6 @@ else() + endif() + endif() + check_function_exists(reallocarray HAS_REALLOCARRAY) +- if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND onnxruntime_target_platform STREQUAL "aarch64") +- check_cxx_compiler_flag(-march=armv8.2-a+bf16 HAS_ARM64_BFLOAT16) +- if(NOT HAS_ARM64_BFLOAT16) +- message(FATAL_ERROR "The compiler doesn't support BFLOAT16!!!") +- endif() +- check_cxx_compiler_flag(-march=armv8.2-a+fp16 HAS_ARM64_FLOAT16) +- if(NOT HAS_ARM64_FLOAT16) +- message(FATAL_ERROR "The compiler doesn't support FLOAT16!!!") +- endif() +- endif() + if (HAS_TAUTOLOGICAL_POINTER_COMPARE) + #we may have extra null pointer checkings in debug build, it's not an issue + list(APPEND ORT_WARNING_FLAGS -Wno-tautological-pointer-compare) diff --git a/O/ONNXRuntime/common.jl b/O/ONNXRuntime/common.jl index 4296d96b23f..e79efbdcd76 100644 --- a/O/ONNXRuntime/common.jl +++ b/O/ONNXRuntime/common.jl @@ -4,6 +4,7 @@ using Pkg sources = AbstractSource[ GitSource("https://github.com/microsoft/onnxruntime.git", "26250ae74d2c9a3c6860625ba4a147ddfb936907"), + DirectorySource(joinpath(@__DIR__, "bundled")), ] script = raw""" @@ -44,6 +45,9 @@ if [[ $target != *-w64-mingw32* ]]; then fi cd onnxruntime + + atomic_patch -p1 ../patches/aarch64-linux-bfloat16-float16-cmake.patch + git submodule update --init --recursive --depth 1 --jobs $nproc mkdir build cd build