shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
620 stars 125 forks source link

can not compile under Visual Studio 17 2022 / ARM64 #558

Open savelov opened 3 weeks ago

savelov commented 3 weeks ago

after mkdir build cd build cmake .. cmake --build . --config Release -- /maxcpucount:1

getting error

C:\Users\savel\sleef\build\src\libm\dispscalar.c(26,1): error C2065: 'Sleef_sind1_u35purec': undeclared identifier [C:\ Users\savel\sleef\build\src\libm\dispscalar_obj.vcxproj] C:\Users\savel\sleef\build\src\libm\dispscalar.c(26,1): error C2065: 'Sleef_sind1_u35purecfma': undeclared identifier [ C:\Users\savel\sleef\build\src\libm\dispscalar_obj.vcxproj]

savelov commented 3 weeks ago

fixed by forcing setting of aarch64 architecture

cmake -DSLEEF_ARCH_AARCH64=1 .. cmake --build . --clean-first --config Release -- /maxcpucount:1

savelov commented 3 weeks ago

probably CMAKE_SYSTEM_PROCESSOR does not correctly match arm64 or aarch64? https://github.com/shibatch/sleef/blob/master/Configure.cmake#L115 I checked and it is ARM64 uppercase (equal to %PROCESSOR_ARCHITECTURE%)

joanaxcruz commented 3 weeks ago

Thank you so much, for looking into this and letting us know. We will investigate on our side and keep you updated if we escalate it with a PR.

blapie commented 2 weeks ago

@savelov At the moment Windows assumes x86, but as you observed we are actually not far off supporting Windows on Arm (ARM64). Happy to see that you managed to bypass the architecture detection and force your config, in order to solve your issue.

The more concerning issue we have on Windows (on x86 and Arm) is actually testing, that's only possible in a Cygwin/POSIX-compliant environment. So even though they can be compiled for ARM64, they cannot be tested (natively) yet.

I will try to merge a config.cmake fix so that at least you don't have to force your config and we can close this issue. But we will have to disable tests, so we cannot claim full support yet.

savelov commented 2 weeks ago

actually after fixing Configure.cmake, I could not properly compile using AdvSIMD instructions, as these variables are being set: set(COMPILER_SUPPORTS_ADVSIMD 1) set(COMPILER_SUPPORTS_ADVSIMDNOFMA 1)

probably Microsoft compiler is not fully compatible - e.g. compare with this PR for llama for visual c++ support, especially re float32x4_t initializers https://github.com/ggerganov/llama.cpp/pull/7191/files