AnsweredAssumed Answered

OpenCL compiler crash

Question asked by eltio on Dec 27, 2019
Latest reply on Dec 27, 2019 by dipak

Hi everyone.

 

When I try to compile OpenCL kernel on my notebook with Radeon HD 7340 GPU, I have segfault inside clBuildProgram function. If I comment line 

b += (val << r[i]) | (val >> (32 - r[i]));

in my kernel source, it executes normally.

 

Valgrind detected problems in the LLVM functions:

==26271== Invalid read of size 8
==26271==    at 0xA4D0C96: llvm::R600TargetLowering::FoldOperand(llvm::SDNode*, unsigned int, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SelectionDAG&) const (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0xA4D13E2: llvm::R600TargetLowering::PostISelFolding(llvm::MachineSDNode*, llvm::SelectionDAG&) const (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0xA4523FE: ??? (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x988B2C3: llvm::SelectionDAGISel::DoInstructionSelection() (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x988A974: llvm::SelectionDAGISel::CodeGenAndEmitDAG() (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x988962D: llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x9886965: llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x9589DF8: llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x941A667: llvm::FPPassManager::runOnFunction(llvm::Function&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x941A8C2: llvm::FPPassManager::runOnModule(llvm::Module&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x941AC8A: llvm::legacy::PassManagerImpl::run(llvm::Module&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==26271==    by 0x7637540: ??? (in /usr/lib/x86_64-linux-gnu/libMesaOpenCL.so.1.0.0)
==26271==  Address 0x50 is not stack'd, malloc'd or (recently) free'd

All this looks like a bug in the compiler.

 

Environment: Linux notebook 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux

Sources and full valgrind log are attached.

Build: gcc -o host host.c -lOpenCL -ggdb

Attachments

Outcomes