cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

eltio
Journeyman III

OpenCL compiler crash

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) | (val >> (32 - r));

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

0 Likes
1 Reply
dipak
Big Boss

Thank you for reporting this. You have been whitelisted.

Radeon HD 7340, which is based on old TeraScale architecture, is a legacy product. This product is under legacy support model and no additional driver release is planned for this device [AMD Radeon™ Software Support for Legacy Graphics Products].

By the way, as I checked with CodeXL, the attached kernel seems building fine for GCN devices.

Thanks.