Closed crazyhappygame closed 11 months ago
- axmol version: v2.0.0
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 Yes. It still crashes manually.
I checked latest version e9f093916e6aaf0ac6810c28bf11b7b084745e59 and I still have the same crash
Steps:
$ git checkout dev
$ git pull
$ git log | head
...
e9f093916e6aaf0ac6810c28bf11b7b084745e59
...
build1k: PowerShell 5.1.19041.3031 on Microsoft Windows 10.0.19045.0
build1k:
Name Value
---- -----
dll False
xt cmake
d G:\dev\axmol
sdk
p
xc {}
cc
prefix G:\dev\axmol\tools\external
xb {--target, HelloCpp, --config, Debug}
a x64
build1k: proj_dir=G:\dev\axmol, prefix=G:\dev\axmol\tools\external build1k: Using glslcc: G:\dev\axmol\tools\external\glslcc\glslcc.exe, version: 1.9.3 build1k: Using cmake: C:\Program Files\CMake\bin\cmake.exe, version: 3.27.7 build1k: Using nuget: G:\dev\axmol\tools\external\nuget\nuget.exe, version: 5.5.1 build1k: Building target win32 on windows with toolchain msvc ... build1k: CONFIG_ALL_OPTIONS=-A x64, Count=2 -- Building for: Visual Studio 17 2022 -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045. -- The C compiler identification is MSVC 19.37.32824.0 -- The CXX compiler identification is MSVC 19.37.32824.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- GLSLCC_OUT_DIR=G:/dev/axmol/build_x64/runtime/axslc -- GLSLCC_FIND_PROG_ROOT=G:/dev/axmol/tools/external/glslcc -- GLSLCC_FRAG_SOURCE_FILE_EXTENSIONS=.frag;.fsh -- GLSLCC_VERT_SOURCE_FILE_EXTENSIONS=.vert;.vsh -- CMAKE_HOST_SYSTEM_VERSION: 10.0.19045 -- CMAKE_SYSTEM_VERSION: 10.0.19045CMake Warning at cmake/Modules/AXConfigDefine.cmake:48 (message):
Forcing set CMAKE_C_STANDARD to 99 when winsdk < 10.0.22000.0 Call Stack (most recent call first): -- CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION: 10.0.19041.0 cmake/Modules/AXBuildSet.cmake:47 (include) CMakeLists.txt:46 (include)
-- CMAKE_C_STANDARD=99 -- Building axmol with c++20 -- Using Windows MSVC generate axmol project, MSVC_VERSION:1937 -- The ASM compiler identification is MSVC -- Found assembler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe -- The ASM_NASM compiler identification is NASM -- Found assembler: C:/Users/Mariusz/AppData/Local/bin/NASM/nasm.exe -- CMAKE_HOST_SYSTEM_NAME:Windows -- CMAKE_SYSTEM_NAME:Windows -- CMAKE_GENERATOR_PLATFORM:x64 -- CMAKE_SYSTEM_PROCESSOR:AMD64 -- CMAKE_CXX_COMPILER_ID:MSVC -- FUZZ_MSVC=TRUE, FULL_CLANG= -- PROJECT_NAME:axmol -- PROJECT_SOURCE_DIR:G:/dev/axmol -- _AX_ROOT:G:/dev/axmol -- CMAKE_MODULE_PATH:G:/dev/axmol/cmake/Modules/ -- PROJECT_BINARY_DIR:G:/dev/axmol/build_x64 -- ENGINE_BINARY_PATH:G:/dev/axmol/build_x64/engine -- ARCH_ALIAS:x64 CMake Warning (dev) at core/CMakeLists.txt:87 (message): AX_USE_GL=ON, AX_USE_METAL=OFF, AX_GLES_PROFILE=300 This warning is for project developers. Use -Wno-dev to suppress it.
-- AX_ENABLE_VLC_MEDIA=OFF -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.36.1.windows.1") ,,,,
3. Open build_x64\axmol.sln
4. Run in debugger Cpp-test
5. Press Press "Start Auto Test" or press "Texture2d" (second test on the list) - crash
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
construct_block_size_descriptor_2d(x_texels, y_texels, can_omit_modes, mode_cutoff, bsd);
00007FF732D79AD7 mov rax,qword ptr [bsd]
00007FF732D79ADC mov qword ptr [rsp+20h],rax
00007FF732D79AE1 vmovss xmm3,dword ptr [mode_cutoff]
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
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
My cpu works:
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 vmoves
is a avx instruction
Yes .I have:
-- Found ZLIB: G:/dev/axmol/thirdparty/zlib/prebuilt/win32/x64/zlib.lib (found version "1.3")
-- Found PNG: png (found version "1.6.40")
CMake Warning (dev) at thirdparty/astcenc/CMakeLists.txt:89 (message):
ASTC_ISA_SIMD=avx2
This warning is for project developers. Use -Wno-dev to suppress it.
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:
ASTC_ISA_SIMD=sse4.2
Yes .I have:
-- Found ZLIB: G:/dev/axmol/thirdparty/zlib/prebuilt/win32/x64/zlib.lib (found version "1.3") -- Found PNG: png (found version "1.6.40") CMake Warning (dev) at thirdparty/astcenc/CMakeLists.txt:89 (message): ASTC_ISA_SIMD=avx2 This warning is for project developers. Use -Wno-dev to suppress it.
And on your machine, the axmol1.0 cmake output ASTC_ISA_SIMD =?
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:
ASTC_ISA_SIMD=sse4.2
Use check_c_source_runs
instead check_c_source_compiles
should works:
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:
21:12:08 CMake Warning (dev) at external/axmol/thirdparty/astcenc/CMakeLists.txt:84 (message):
21:12:08 ASTC_ISA_SIMD=sse2
21:12:08 This warning is for project developers. Use -Wno-dev to suppress it.
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 https://github.com/axmolengine/axmol/blob/1.0/thirdparty/CMakeLists.txt#L63
for axmol v1.0.0 on my machine I have:
21:12:08 CMake Warning (dev) at external/axmol/thirdparty/astcenc/CMakeLists.txt:84 (message): 21:12:08 ASTC_ISA_SIMD=sse2 21:12:08 This warning is for project developers. Use -Wno-dev to suppress it.
This is also strange, since the Intel product page shows this:
Instruction Set Extensions Intel® SSE4.2
So it should be ASTC_ISA_SIMD=sse4.2
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 -A Win32
? if true, will only check sse2 and use it
The commit https://github.com/axmolengine/axmol/commit/fcd3312365a2da77f3dec0a6e04b5555248e658a 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 sse2
Thank you. For latest version on my machine I see
CMake Warning (dev) at thirdparty/astcenc/CMakeLists.txt:56 (message):
ASTC_ISA_SIMD=sse4.1
No crashes any more. Thank you!
Is v2.0.0 ready for production or it is better to stay with v1.0.0