[Mesa-dev] [Libclc-dev] opencl-example: didn't compile (run) with latest LLVM git (for some days)

Dieter Nützel Dieter at nuetzel-hh.de
Thu Sep 28 12:15:45 UTC 2017


Hello Jan, hello Emil,

I've found it. It isn't a LLVM but a Mesa clover build problem. After 
Jan pointed me to build clover with

--enable-opencl_icd switch in mesa to create an ICD driver
(libMesaOpenCL.so) and the corresponding vendors file (installed as 
/etc/OpenCL/vendors/mesa.icd)

libOpenCL.so wouldn't be build the right way.

With --enable-opencl_icd a 'new' libMesaOpenCL.so.1.0.0 would be build 
in mesa/lib64/gallium/ and a 'linked'  libOpenCL.so.1.0.0 version. But 
the later is broken (missing symbols).

A 'rebuild' without '--enable-opencl_icd' isn't enough to circumvent 
this mess. I had to 'make distclean' plus remove all libMesaOpenCL* 
references by hand to build a new clean _working_ libOpenCL* lib.

Now,
'opencl-example/run_tests.sh' and '/opt/amdgpu-pro/bin/clinfo' works 
like a charm, again.
The later show nice new int64 support.

To-do
Find the wrong mesa --enable-opencl_icd build option commands/config 
which result in bad libMesaOpenCL/libOpenCL libraries.

Greetings,
Dieter

Am 20.09.2017 19:26, schrieb Jan Vesely:
> adding mesa-dev. This is not really related to libclc.
> 
> On Wed, 2017-09-20 at 12:50 +0200, Dieter Nützel via Libclc-dev wrote:
>> Worked OK with older version (for me latest was #6c9f36933c5) but with
>> your 'clover: Fix build after LLVM r313390' reverted.
>> 
>> Now I get this during compilation tries:
>> 
>> /opt/opencl-example> make
>> gcc -o hello_world hello_world.o cl_simple.o cl_util.o 
>> -L/usr/local/lib
>> -lOpenCL
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::LLVMContext::getDiagnosticHandler() const at LLVM_6.0'
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::isKnownNonNull(llvm::Value const*)@LLVM_6.0'
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::DIBuilder::createCompileUnit(unsigned int, llvm::DIFile*,
>> llvm::StringRef, bool, llvm::StringRef, unsigned int, llvm::StringRef,
>> llvm::DICompileUnit::DebugEmissionKind, unsigned long, bool,
>> bool)@LLVM_6.0'
> 
> This is odd, this function is pretty old.
> 
>> /usr/local/lib64/libOpenCL.so: undefined reference to
>> `llvm::LLVMContext::setDiagnosticHandler(void (*)(llvm::DiagnosticInfo
>> const&, void*), void*, bool)@LLVM_6.0'
>> collect2: error: ld returned 1 exit status
>> make: *** [Makefile:10: hello_world] Fehler 1
>> 
>> Greetings,
>> Dieter
>> 
>> For reference (running '/opt/amdgpu-pro/bin/clinfo'):
>> 
>> /opt/opencl-example> /opt/amdgpu-pro/bin/clinfo
>> /opt/amdgpu-pro/bin/clinfo: /usr/local/lib64/libOpenCL.so.1: no 
>> version
>> information available (required by /opt/amdgpu-pro/bin/clinfo)
>> /opt/amdgpu-pro/bin/clinfo: /usr/local/lib64/libOpenCL.so.1: no 
>> version
>> information available (required by /opt/amdgpu-pro/bin/clinfo)
>> ATTENTION: default value of option mesa_glthread overridden by
>> environment.
>> ATTENTION: default value of option radeonsi_assume_no_z_fights
>> overridden by environment.
>> ATTENTION: default value of option radeonsi_commutative_blend_add
>> overridden by environment.
>> ATTENTION: default value of option mesa_glthread overridden by
>> environment.
>> Number of platforms:                             1
>>    Platform Profile:                              FULL_PROFILE
>>    Platform Version:                              OpenCL 1.1 Mesa
>> 17.3.0-devel (git-94fef19509)
>>    Platform Name:                                 Clover
>>    Platform Vendor:                               Mesa
>>    Platform Extensions:                           cl_khr_icd
>> 
>> 
>>    Platform Name:                                 Clover
>> Number of devices:                               1
>>    Device Type:                                   CL_DEVICE_TYPE_GPU
>>    Vendor ID:                                     1002h
>>    Max compute units:                             36
>>    Max work items dimensions:                     3
>>      Max work items[0]:                           256
>>      Max work items[1]:                           256
>>      Max work items[2]:                           256
>>    Max work group size:                           256
>>    Preferred vector width char:                   16
>>    Preferred vector width short:                  8
>>    Preferred vector width int:                    4
>>    Preferred vector width long:                   2
>>    Preferred vector width float:                  4
>>    Preferred vector width double:                 2
>>    Native vector width char:                      16
>>    Native vector width short:                     8
>>    Native vector width int:                       4
>>    Native vector width long:                      2
>>    Native vector width float:                     4
>>    Native vector width double:                    2
>>    Max clock frequency:                           1411Mhz
>>    Address bits:                                  64
>>    Max memory allocation:                         6010904166
>>    Image support:                                 No
>>    Max size of kernel argument:                   1024
>>    Alignment (bits) of base address:              1024
>>    Minimum alignment (bytes) for any datatype:    128
>>    Single precision floating point capability
>>      Denorms:                                     No
>>      Quiet NaNs:                                  Yes
>>      Round to nearest even:                       Yes
>>      Round to zero:                               No
>>      Round to +ve and infinity:                   No
>>      IEEE754-2008 fused multiply-add:             No
>>    Cache type:                                    None
>>    Cache line size:                               0
>>    Cache size:                                    0
>>    Global memory size:                            8587005952
>>    Constant buffer size:                          2147483647
>>    Max number of constant args:                   16
>>    Local memory type:                             Scratchpad
>>    Local memory size:                             32768
>> /opt/amdgpu-pro/bin/clinfo: relocation error:
>> /usr/local/lib64/libOpenCL.so.1: symbol
>> _ZN4llvm11LLVMContext20setDiagnosticHandlerEPFvRKNS_14DiagnosticInfoEPvES4_b,
>> version LLVM_6.0 not defined in file libLLVM-6.0svn.so with link time
>> reference
> 
> this looks like libLLVM-6.0svn.so is an older version than what you
> built clover against. Did you rebuild and reinstall llvm after r313390?
> 
> Jan


More information about the mesa-dev mailing list