microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.73k stars 2.94k forks source link

[Build] v1.20.0 min GCC version can't build on armv8 #22837

Open AxelZi opened 5 days ago

AxelZi commented 5 days ago

Describe the issue

The GCC version is checked to be at least version 9 in the CMakeLists.txt. https://github.com/microsoft/onnxruntime/blob/c4fb724e810bb496165b9015c77f402727392933/cmake/CMakeLists.txt#L69

When building on armv8 with GCC 9 the check further down fails https://github.com/microsoft/onnxruntime/blob/c4fb724e810bb496165b9015c77f402727392933/cmake/CMakeLists.txt#L693

It seems the feature modifier bf16 was introduced in GCC 10 see here.
If I'm not mistaken the minimum GCC version checked for should be rather be 10 instead of 9.

Urgency

No response

Target platform

armv8

Build script

Using build.py with --parallel 4 --config Release --build_dir build --cmake_extra_defines FETCHCONTENT_TRY_FIND_PACKAGE_MODE=NEVER

Error / output

-- Performing Test HAS_ARM64_BFLOAT16 - Failed
CMake Error at CMakeLists.txt:695 (message):
  The compiler doesn't support BFLOAT16!!!

Visual Studio Version

No response

GCC / Compiler Version

9.5.0

snnn commented 5 days ago

We only tested the code with GCC 11,12 and 13. And I know in some cases even GCC 11 doesn't work. For example, RHEL 9 has GCC 11, and its assembler cannot be used for compiling our code.