intel / intel-graphics-compiler

Other
594 stars 155 forks source link

Internal compiler error when building LLVM along with IGC #315

Closed pvelesko closed 7 months ago

pvelesko commented 7 months ago

Following instructions from the README, on a brand new install of Ubuntu 22.04 on an 13th Gen Intel(R) Core(TM) i9-13900K with HyperThreading disabled.

This seems to only happen once I exceed the number of E-cores I have on my system and happens when trying to build LLVM on my own. Since E-cores and P-cores differ in uarch, is it possible that the illegal instruction stems from an instruction being executed on the E-core that was meant to be run on the P-core?

Linux cupcake 6.2.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Jul 13 16:27:29 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

╭─pvelesko@cupcake ~/intel-compute-runtime-build ‹main●›
╰─$ gcc --version                                                                                                                                                                                                                                                                                                                                                     130 ↵
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    git clone https://github.com/intel/intel-graphics-compiler.git igc
    git clone https://github.com/intel/vc-intrinsics vc-intrinsics
    git clone -b llvmorg-14.0.5 https://github.com/llvm/llvm-project llvm-project
    git clone -b ocl-open-140 https://github.com/intel/opencl-clang llvm-project/llvm/projects/opencl-clang
    git clone -b llvm_release_140 https://github.com/KhronosGroup/SPIRV-LLVM-Translator llvm-project/llvm/projects/llvm-spirv
    git clone https://github.com/KhronosGroup/SPIRV-Tools.git SPIRV-Tools
    git clone https://github.com/KhronosGroup/SPIRV-Headers.git SPIRV-Headers

[ 68%] Linking CXX static library ../../libLLVMMCJIT.a
[ 68%] Built target LLVMMCJIT
during GIMPLE pass: fre
/space/pvelesko/intel-compute-runtime-build/igc/build/IGC/llvm-deps/src/llvm/lib/Transforms/Utils/SimplifyCFG.cpp: In function ‘void __static_initialization_and_destruction_0(int, int)’:
/space/pvelesko/intel-compute-runtime-build/igc/build/IGC/llvm-deps/src/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6797:1: internal compiler error: Illegal instruction
 6797 | }
      | ^
0x7f67fcc4251f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7f67fcc29d8f __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7f67fcc29e3f __libc_start_main_impl
        ../csu/libc-start.c:392
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
gmake[2]: *** [IGC/llvm-deps/build/src/lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/build.make:986: IGC/llvm-deps/build/src/lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SimplifyCFG.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:11274: IGC/llvm-deps/build/src/lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2
```1
pvelesko commented 7 months ago

Similar error, using num-threads = p-cores

[ 45%] Linking CXX static library ../../libLLVMMCJIT.a
[ 45%] Built target LLVMMCJIT
during GIMPLE pass: pre
/space/pvelesko/intel-compute-runtime-build/neo/build/igc/IGC/llvm-deps/src/llvm/lib/Transforms/Utils/SimplifyCFG.cpp: In function ‘bool {anonymous}::SimplifyCFGOpt::SpeculativelyExecuteBB(llvm::BranchInst*, llvm::BasicBlock*, const llvm::TargetTransformInfo&)’:
/space/pvelesko/intel-compute-runtime-build/neo/build/igc/IGC/llvm-deps/src/llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2394:6: internal compiler error: Segmentation fault
 2394 | bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB,
      |      ^~~~~~~~~~~~~~
0x7fba8904251f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fba89029d8f __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7fba89029e3f __libc_start_main_impl
        ../csu/libc-start.c:392
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
gmake[2]: *** [igc/IGC/llvm-deps/build/src/lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/build.make:986: igc/IGC/llvm-deps/build/src/lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/SimplifyCFG.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:13682: igc/IGC/llvm-deps/build/src/lib/Transforms/Utils/CMakeFiles/LLVMTransformUtils.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2
pvelesko commented 7 months ago

Similar error when trying to use clang-14

[3342/7452] Building CXX object igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o
FAILED: igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o 
/usr/bin/clang++ @igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o.rsp -MD -MT igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o -MF igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o.d -o igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o -c /space/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp
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++ @igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o.rsp -MD -MT igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o -MF igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o.d -o igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXLowering.cpp.o -c /space/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/space/pvelesko/intel-compute-runtime-build/igc/IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp'.
4.      Running pass 'Live DEBUG_VALUE analysis' on function '@_Z28getPredicateForLoadSplittingPN4llvm8CallInstE'
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):
/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x31)[0x7f17e803fd01]
/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0xee)[0x7f17e803da3e]
/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0xfb)[0x7f17e803f0ab]
/lib/x86_64-linux-gnu/libLLVM-14.so.1(+0xd6bdff)[0x7f17e7f6bdff]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f17e6a42520]
/lib/x86_64-linux-gnu/libLLVM-14.so.1(_ZN4llvm13LexicalScopes24getOrCreateAbstractScopeEPKNS_12DILocalScopeE+0x63)[0x7f17e8309183]
[0x5420250]
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: 
********************

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

********************
[3343/7452] Building CXX object igc/IGC/VectorCompiler/lib/GenXCodeGen/CMakeFiles/VCCodeGen.dir/GenXCisaBuilder.cpp.o
ninja: build stopped: subcommand failed.
pvelesko commented 7 months ago

Turns out to be due to a faulty CPU.