Skip to content

Clang 18.1.0 (bba39443eb91) crashes when extending a BF16 subvector to a larger vector on AVX512BF16 #83358

Closed
@johnplatts

Description

@johnplatts

Here is the error that occurs in Clang 18.1.0 (++20240221023121+bba39443eb91-1exp120240221023233.52) when an 128-bit BF16 vector resulting from a _mm256_cvtneps_pbh operation is extended to a 512-bit vector:

fatal error: error in backend: Cannot select: 0x55b077581770: v32bf16 = insert_subvector undef:v32bf16, 0x55b0797a8920, Constant:i64<0>, jep_google_highway/hwy/ops/x86_512-inl.h:3789:31 @[ jep_google_highway/hwy/tests/dup128_vec_test.cc:112:12 @[ jep_google_highway/hwy/tests/dup128_vec_test.cc:181:5 ] ]
  0x55b0767bbb30: v32bf16 = undef
  0x55b0797a8920: v8bf16 = llvm.x86.vcvtneps2bf16256 TargetConstant:i64<13501>, 0x55b0772e8670, jep_google_highway/hwy/ops/x86_256-inl.h:6390:45 @[ jep_google_highway/hwy/tests/dup128_vec_test.cc:103:29 @[ jep_google_highway/hwy/tests/dup128_vec_test.cc:181:5 ] ]
    0x55b07807f7d0: i64 = TargetConstant<13501>
    0x55b0772e8670: v8f32,ch = load<(load (s256) from constant-pool)> 0x55b0815e7dd0, 0x55b07aaa9630, undef:i64, jep_google_highway/hwy/ops/x86_256-inl.h:6390:45 @[ jep_google_highway/hwy/tests/dup128_vec_test.cc:103:29 @[ jep_google_highway/hwy/tests/dup128_vec_test.cc:181:5 ] ]
      0x55b07aaa9630: i64 = X86ISD::WrapperRIP TargetConstantPool:i64<<8 x float> <float -1.600000e+01, float -1.500000e+01, float -1.400000e+01, float -1.300000e+01, float -1.200000e+01, float -1.100000e+01, float -1.000000e+01, float -9.000000e+00>> 0
        0x55b07aa9a320: i64 = TargetConstantPool<<8 x float> <float -1.600000e+01, float -1.500000e+01, float -1.400000e+01, float -1.300000e+01, float -1.200000e+01, float -1.100000e+01, float -1.000000e+01, float -9.000000e+00>> 0
      0x55b0775743c0: i64 = undef
  0x55b076ffdee0: i64 = Constant<0>
In function: _ZN3hwy11N_AVX3_ZEN423TestDup128VecFromValuesclINS_10bfloat16_tENS0_4SimdIS3_Lm32ELi0EEEEEvT_T0_
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_bf16_avx3_zen4_021724/jep_google_highway -isystem /home/jplatts/jepprojects/hwy_bf16_avx3_zen4_021724/hwy_clang18_zen4_build/googletest-src/googletest/include -isystem /home/jplatts/jepprojects/hwy_bf16_avx3_zen4_021724/hwy_clang18_zen4_build/googletest-src/googletest -march=znver4 -DHWY_DISABLED_TARGETS=6917529027641114559 -DHWY_WANT_AVX3_ZEN4=1 -DHWY_COMPILE_ONLY_STATIC=1 -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 -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++17 -MD -MT CMakeFiles/dup128_vec_test.dir/hwy/tests/dup128_vec_test.cc.o -MF CMakeFiles/dup128_vec_test.dir/hwy/tests/dup128_vec_test.cc.o.d -o CMakeFiles/dup128_vec_test.dir/hwy/tests/dup128_vec_test.cc.o -c /home/jplatts/jepprojects/hwy_bf16_avx3_zen4_021724/jep_google_highway/hwy/tests/dup128_vec_test.cc
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '/home/jplatts/jepprojects/hwy_bf16_avx3_zen4_021724/jep_google_highway/hwy/tests/dup128_vec_test.cc'.
4.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN3hwy11N_AVX3_ZEN423TestDup128VecFromValuesclINS_10bfloat16_tENS0_4SimdIS3_Lm32ELi0EEEEEvT_T0_'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  libLLVM-18.so.1    0x00007f396ed866d6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 54
1  libLLVM-18.so.1    0x00007f396ed84690 llvm::sys::RunSignalHandlers() + 80
2  libLLVM-18.so.1    0x00007f396ecd60ee
3  libLLVM-18.so.1    0x00007f396ecd60ab
4  libLLVM-18.so.1    0x00007f396ed80f47 llvm::sys::Process::Exit(int, bool) + 39
5  clang++-18         0x000055b075544143
6  libLLVM-18.so.1    0x00007f396ece3932 llvm::report_fatal_error(llvm::Twine const&, bool) + 274
7  libLLVM-18.so.1    0x00007f396f5e59b0 llvm::SelectionDAGISel::isOrEquivalentToAdd(llvm::SDNode const*) const + 0
8  libLLVM-18.so.1    0x00007f396f5e4e38 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) + 16168
9  libLLVM-18.so.1    0x00007f3971a67313
10 libLLVM-18.so.1    0x00007f396f5dc5df llvm::SelectionDAGISel::DoInstructionSelection() + 431
11 libLLVM-18.so.1    0x00007f396f5dbcc1 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1441
12 libLLVM-18.so.1    0x00007f396f5dade2 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 4354
13 libLLVM-18.so.1    0x00007f396f5d8f9e llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1726
14 libLLVM-18.so.1    0x00007f3971a5d11f
15 libLLVM-18.so.1    0x00007f396f146e34 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 852
16 libLLVM-18.so.1    0x00007f396eeccdff llvm::FPPassManager::runOnFunction(llvm::Function&) + 687
17 libLLVM-18.so.1    0x00007f396eed26f3 llvm::FPPassManager::runOnModule(llvm::Module&) + 51
18 libLLVM-18.so.1    0x00007f396eecd4f4 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1012
19 libclang-cpp.so.18 0x00007f39773bfe0e clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) + 7710
20 libclang-cpp.so.18 0x00007f397774f062 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1538
21 libclang-cpp.so.18 0x00007f397637fd56 clang::ParseAST(clang::Sema&, bool, bool) + 614
22 libclang-cpp.so.18 0x00007f39781b0625 clang::FrontendAction::Execute() + 85
23 libclang-cpp.so.18 0x00007f3978129c14 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 708
24 libclang-cpp.so.18 0x00007f397822adce clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 750
25 clang++-18         0x000055b075543d65 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 4069
26 clang++-18         0x000055b075541165
27 libclang-cpp.so.18 0x00007f3977de1f79
28 libLLVM-18.so.1    0x00007f396ecd608c llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 140
29 libclang-cpp.so.18 0x00007f3977de190e clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const + 366
30 libclang-cpp.so.18 0x00007f3977da9ea1 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const + 897
31 libclang-cpp.so.18 0x00007f3977daa0ee clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const + 142
32 libclang-cpp.so.18 0x00007f3977dc66cd clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) + 333
33 clang++-18         0x000055b075540ad4 clang_main(int, char**, llvm::ToolContext const&) + 11172
34 clang++-18         0x000055b07554dbf6 main + 102
35 libc.so.6          0x00007f396d829d90
36 libc.so.6          0x00007f396d829e40 __libc_start_main + 128
37 clang++-18         0x000055b07553dbd5 _start + 37
clang++-18: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 18.1.0 (++20240221023121+bba39443eb91-1~exp1~20240221023233.52)
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/dup128_vec_test-cfb5fa.cpp
clang++-18: note: diagnostic msg: /tmp/dup128_vec_test-cfb5fa.sh
clang++-18: note: diagnostic msg: 

********************

Here are the diagnostic files for the above error:
dup128_vec_test_clang18_error.zip

Metadata

Metadata

Assignees

Labels

backend:X86crashPrefer [crash-on-valid] or [crash-on-invalid]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions