-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
ISA_SIMD illegal instructions crashes on windows x64 #1381
Comments
Is that based on the v2.0.0 tag? If you navigate to the test that caused the crash manually (don't use auto-test), does it still crash? Exactly which test causes the crash? I couldn't reproduce this issue with the latest dev branch snapshot, so perhaps it's something that was already fixed. |
Yes. I used V2.0.0 tag I checked latest version e9f0939 and I still have the same crash Steps:
|
I can't reproduece this issue |
compiler bug?, clean and rebuild may solve your problem |
I clean/rebuild multiplie times. It works fine for V1.0.0 it fails on V2.0.0 and latest. "Illegal instructions" means that compiled code is not compatible with my CPU ... It looks like my CPU (Intel(R) Xeon(R) CPU X5670 @ 2.93GHz ) does not support vmovss
If that works for V1.0.0 and does not for V2.0.0 my guess would be that thirdparty\astcenc latest changes does not support older CPUs |
Unless I'm mistaken, both V2.0.0 and V1.0.0 are using the exact same version of astcenc (Version: 4.5.0). Perhaps it's a configuration issue? |
Yes, the version of astcenc is same |
Could something have changed in Axmol 2.0.0 with the cmake configuration to accidentally detect incorrect support for those instructions? |
@crazyhappygame please check your cmake output: |
AVX instruction sets are not supported on the Intel Xeon CPU X5670, so if it's somehow detecting that they are, then that would be the issue. |
Yes: https://ark.intel.com/content/www/us/en/ark/products/47920/intel-xeon-processor-x5670-12m-cache-2-93-ghz-6-40-gt-s-intel-qpi.html |
Yes .I have:
|
The problem is likely to be in this file: https://github.com/axmolengine/axmol/commits/dev/thirdparty/CMakeLists.txt A lot of changes were made to it between Axmol v1.0.0 to v2.0.0, and it's where the instruction set configuration seems to be set up. The correct output for the Xeon X5670 should be: |
And on your machine, the axmol1.0 cmake output ASTC_ISA_SIMD =? |
Use include(CheckCSourceRuns)
check_c_source_runs("#include <immintrin.h>
#include <stdint.h>
int main()
{
__m256 m = _mm256_set_ps(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
return (int)*(float*)&m;
}" AX_HAVE_AVX2_INTRINSICS) |
for axmol v1.0.0 on my machine I have:
|
Strange: the SIMD instrinsics Detetion logic is really same between axmol 1.0 and 2.0: https://github.com/axmolengine/axmol/blob/dev/thirdparty/CMakeLists.txt#L63 |
This is also strange, since the Intel product page shows this: So it should be |
And if you build x64, should never use SSE2: https://github.com/axmolengine/axmol/blob/1.0/thirdparty/astcenc/CMakeLists.txt#L47 if (NOT DEFINED ASTC_ISA_SIMD)
if (NOT (ARCH_ALIAS STREQUAL "x86") AND NOT TVOS)
set(ASTC_HAVE_AVX2_INTRINSICS ${AX_HAVE_AVX2_INTRINSICS})
set(ASTC_HAVE_SSE42_INTRINSICS ${AX_HAVE_SSE42_INTRINSICS})
set(ASTC_HAVE_SSE41_INTRINSICS ${AX_HAVE_SSE41_INTRINSICS})
if (AX_HAVE_NEON_INTRINSICS)
set(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
check_cxx_source_compiles("#include <arm_neon.h>
int main()
{
int32x4_t ret4 = vdupq_n_s32(0);
uint32x4_t v{};
float16x4_t f16 = vcvt_f16_f32(v);
return vgetq_lane_s32(ret4, 0);
}" ASTC_HAVE_NEON_INTRINSICS)
set(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
unset(OLD_REQUIRED_FLAGS)
endif()
else()
set(ASTC_HAVE_SSE2_INTRINSICS ${AX_HAVE_SSE2_INTRINSICS})
message(AUTHOR_WARNING "Skipping AVX2/SSE4/NEON detection for astc-encoder when build target 'x86' and 'tvos'")
endif()
### set ASTC_ISA_SIMD
if(ASTC_HAVE_AVX2_INTRINSICS)
set(ASTC_ISA_SIMD "avx2")
elseif(ASTC_HAVE_SSE42_INTRINSICS)
set(ASTC_ISA_SIMD "sse4.2")
elseif(ASTC_HAVE_SSE41_INTRINSICS)
set(ASTC_ISA_SIMD "sse4.1")
elseif(ASTC_HAVE_SSE2_INTRINSICS)
set(ASTC_ISA_SIMD "sse2")
elseif(ASTC_HAVE_NEON_INTRINSICS)
set(ASTC_ISA_SIMD "neon")
else()
set(ASTC_ISA_SIMD "none")
endif()
message(AUTHOR_WARNING "ASTC_ISA_SIMD=${ASTC_ISA_SIMD}")
endif() |
@crazyhappygame You build axmol-1.0 x86 via |
Add cmake option `AX_ISA_LEVEL` Note: we set default AX_ISA_LEVEL to 2 for sse4.1 for axmol app can runs on large amount devices If you want axmol app runs on more old devices, you can specify in cmake cmdline `-DAX_ISA_LEVEL=2`, otherwise, host compiler generated instructions will crash on old devices which not support high level SIMD instructions.
Add cmake option `AX_ISA_LEVEL` Note: we set default AX_ISA_LEVEL to 2 for sse4.1 for axmol app can runs on large amount devices If you want axmol app runs on more old devices, you can specify in cmake cmdline `-DAX_ISA_LEVEL=1` or `-DAX_ISA_LEVEL=0` to disable SIMD acceleration for thirdparty astcenc and webp otherwise, host compiler generated instructions will crash on old devices which not support high level SIMD instructions.
Add cmake option `AX_ISA_LEVEL` Note: we set default AX_ISA_LEVEL to 2 for sse4.1 for axmol app can runs on large amount devices If you want axmol app runs on more old devices, you can specify in cmake cmdline `-DAX_ISA_LEVEL=1` or `-DAX_ISA_LEVEL=0` to disable SIMD acceleration for thirdparty astcenc and webp otherwise, host compiler generated instructions will crash on old devices which not support high level SIMD instructions.
The commit fcd3312 improve SIMD instructions detction, and should fix this issue, note: this is not axmol2 spec issue, when build axmol1 x64 should have this issue. both axmol1 & 2 x86 never trigger this issue due to max ISA_SIMD is |
Thank you.
No crashes any more. Thank you! |
Steps to Reproduce:
Is v2.0.0 ready for production or it is better to stay with v1.0.0
The text was updated successfully, but these errors were encountered: