Open aungthetnaing opened 5 months ago
Please download protobuf 3.21.12 from https://www.nuget.org/packages/Google.Protobuf, unzip the package, then set ONNX_CUSTOM_PROTOC_EXECUTABLE to the path of the x64 version of protoc.exe. Put ONNX_CUSTOM_PROTOC_EXECUTABLE
in cmake_extra_defines .
Please download protobuf 3.21.12 from https://www.nuget.org/packages/Google.Protobuf, unzip the package, then set ONNX_CUSTOM_PROTOC_EXECUTABLE to the path of the x64 version of protoc.exe. Put ONNX_CUSTOM_PROTOC_EXECUTABLE in cmake_extra_defines .
This step is not required for --arm64 flag run in host x64. So, I believe we should fix it in a way that --arm64 flag will behave the same in both x64 and arm64 host.
Platform flags like --arm64
or --x86
are intended for cross compiling. If you're not cross-compiling, simply don't add the --arm64
flag.
This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.
Building from source on arm64 device without --arm64 flag (build.bat --build_shared_lib --config Release --parallel --skip_submodule_sync --skip_tests --use_dml --cmake_generator "Visual Studio 17 2022" ) works fine but same binary on x64 fails to execute with error - "onnxruntime_perf_test.exe is valid, but it is for a machine type other than the current machine". I tried on X Elite with commit id - https://github.com/microsoft/onnxruntime/commit/80b56feb412f7b9a637efee5ab2f31d00ec07643.
Few app vendors will be shipping single onnxruntime.dll for ARM/x64. How to generate binary cross compatible and uses native instructions - x64 : AVX/AVX2 ; ARM: NEON (not emulated).
You want a single binary that supports both x64 and arm64 CPUs ?
On Windows we support 4 ABIs:
Except for ARM64EC, you can build the code natively on a CPU with the instruction set and with a python.exe with the same ABI. In this case, you do not need to add the flags like "--arm64". For example, if you want a ARM64 binary, you get a ARM64 python.exe from python.org, the use the python to build ONNX Runtime code and do not add the "--arm64" flag. If you want to build for ARM64EC, you need to add the "--arm64ec" flag. If you want to build for ARM64 or ARM64EC in a x64 Windows, you need to add the "--arm64" or "--arm64ec" flag.
Describe the issue
--arm64 should not mean that there is cross-compilation. --arm64 flag should work in both arm64 and x64 hosts.
After this PR https://github.com/microsoft/onnxruntime/commit/8d09baf49f03ff8a50e30f1c662ea706ab657bb5
--arm64 flag in arm64 host will fail with the following error-check.
CMAKE_HOST_SYSTEM_NAME: Windows CMake Error at external/onnxruntime_external_deps.cmake:189 (message): ONNX_CUSTOM_PROTOC_EXECUTABLE must be set to cross-compile. Call Stack (most recent call first): CMakeLists.txt:586 (include)
Urgency
No response
Target platform
arm64
Build script
build.bat --build_shared_lib --config Release --parallel --skip_submodule_sync --skip_tests --use_binskim_compliant_compile_flags --msvc_toolset v143 --arm64 --enable_msvc_static_runtime --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF "CMAKE_C_FLAGS=/Qspectre /guard:cf /Zi" "CMAKE_CXX_FLAGS=/Qspectre /guard:cf /Zi" "CMAKE_SHARED_LINKER_FLAGS=/guard:cf /DYNAMICBASE /DEBUG" "CMAKE_EXE_LINKER_FLAGS=/guard:cf /DYNAMICBASE /DEBUG"
Error / output
CMAKE_HOST_SYSTEM_NAME: Windows CMake Error at external/onnxruntime_external_deps.cmake:189 (message): ONNX_CUSTOM_PROTOC_EXECUTABLE must be set to cross-compile. Call Stack (most recent call first): CMakeLists.txt:586 (include)
Visual Studio Version
VS2022
GCC / Compiler Version
No response