llvm / llvm-project

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

AMDGPU/TeraScale: Mesa's OpenCL implementation Clover crashes on `llvm::TargetInstrInfo::ReplaceTailWithBranchTo()` #62832

Open Mek101 opened 1 year ago

Mek101 commented 1 year ago

Originally posted here: https://github.com/void-linux/void-packages/issues/43921

Running some models causes Mesa's OpenCL implementation for TeraScale (Clover) to call llvm::TargetInstrInfo::ReplaceTailWithBranchTo() from /usr/lib/libLLVM-15.so, which itself is provided by libllvm version 15. This call causes a segmentation fault (verified via gdb).

To reproduce the bug:

In my particular case I'm using an old Radeon 8670D, a Terascale 3 iGPU with the radeon kernel driver. Since segmentation faults are typically caused by null-pointer dereferencing in CPU code I tried to solve the problem in the linked issue by patching llvm with a backport of https://github.com/llvm/llvm-project/commit/17069608940d22cd6266afb948443b11793f0a57, but the segmentation fault still occurred.

Mek101 commented 1 year ago

For some reason GDB doesn't suspend execution even if I put breakpoints, however the segfault, according to gdb, seems to origin from this line.

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-amdgpu

llvmbot commented 1 year ago

@llvm/issue-subscribers-opencl

Mek101 commented 1 year ago

I tried building llvm in debug mode (-Og gcc's option), but I don't have enough ram/swap and my system locks up before finishing