llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.05k stars 11.98k forks source link

Clang 18.1.6 crashes in TestFind with SIMD tag with hwy::float16_t lane type on AVX512_FP16 #92035

Open johnplatts opened 6 months ago

johnplatts commented 6 months ago

Here is the crash that occurs when compiling TestFind for vector types that have a SIMD tag with a lane type of hwy::float16_t for x86_64 with -march=sapphirerapids when compiled with Clang 18.1.6:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.  Program arguments: /usr/bin/clang++-18 -DHWY_STATIC_DEFINE -DTOOLCHAIN_MISS_ASM_HWCAP_H -I/home/jplatts/jepprojects/hwy_avx3_dl_clang_f16_051324/jep_google_highway -isystem /home/jplatts/jepprojects/hwy_avx3_dl_clang_f16_051324/avx3_spr_build/googletest-src/googletest/include -isystem /home/jplatts/jepprojects/hwy_avx3_dl_clang_f16_051324/avx3_spr_build/googletest-src/googletest -march=sapphirerapids -DHWY_COMPILE_ONLY_STATIC=1 -ftrapv -O2 -g -DNDEBUG -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -fmerge-all-constants -Wall -Wextra -Wconversion -Wsign-conversion -Wvla -Wnon-virtual-dtor -Wcast-align -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wgnu-redeclared-enum -Winfinite-recursion -Wself-assign -Wstring-conversion -Wtautological-overlap-compare -Wthread-safety-analysis -Wundefined-func-template -fno-cxx-exceptions -fno-slp-vectorize -fno-vectorize -fdiagnostics-show-option -fcolor-diagnostics -Wc++2a-extensions -fmath-errno -fno-exceptions -Wno-psabi -Werror -DHWY_IS_TEST=1 -std=c++14 -MD -MT CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o -MF CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o.d -o CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o -c /home/jplatts/jepprojects/hwy_avx3_dl_clang_f16_051324/jep_google_highway/hwy/contrib/algo/find_test.cc
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module '/home/jplatts/jepprojects/hwy_avx3_dl_clang_f16_051324/jep_google_highway/hwy/contrib/algo/find_test.cc'.
4.  Running pass 'Early Machine Loop Invariant Code Motion' on function '@_ZN3hwy10N_AVX3_SPR8TestFindclINS0_4SimdINS_9float16_tELm32ELi0EEEEEvT_mmRNS_11RandomStateE'
#0 0x00007d32a19946d6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xd946d6)
#1 0x00007d32a1992690 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xd92690)
#2 0x00007d32a18e41b0 (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0xce41b0)
#3 0x00007d32a0442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007d32a47f44f4 (/usr/lib/llvm-18/bin/../lib/libLLVM.so.18.1+0x3bf44f4)
clang++-18: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 18.1.6 (++20240513065742+09615ce869b0-1~exp1~20240513065903.119)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang++-18: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++-18: note: diagnostic msg: /tmp/find_test-aae644.cpp
clang++-18: note: diagnostic msg: /tmp/find_test-aae644.sh
clang++-18: note: diagnostic msg: 

********************
make[3]: *** [CMakeFiles/find_test.dir/build.make:76: CMakeFiles/find_test.dir/hwy/contrib/algo/find_test.cc.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1169: CMakeFiles/find_test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1176: CMakeFiles/find_test.dir/rule] Error 2
make: *** [Makefile:621: find_test] Error 2

Attached are preprocessed soruces and run script: avx3_spr_f16_find_test_051324_0418pm.zip

The same code compiles successfully with GCC 12 or later.

BwL1289 commented 4 months ago

Also experiencing.

johnplatts commented 3 months ago

Clang 19.1.0 (++20240810103829+866686180a31-1~exp1~20240810103957.18) is able to successfully compile https://github.com/google/highway/blob/master/hwy/contrib/algo/find_test.cc without crashing, even with optimizations enabled.