[Beignet] cl_khr_fp64 on OpenCL 1.2+

Brian Paterni bpaterni at gmail.com
Wed Mar 2 16:54:52 UTC 2016


The default llvm/clang on debian is 3.6, and that is what I had
installed. 3.7 is available and I have it installed, but the trouble now
is getting beignet to see it. I've changed the following cmake variables:

    CLANG_EXECUTABLE                 /usr/bin/clang-3.7
    LLVM_AS_EXECUTABLE               /usr/bin/llvm-as-3.7
    LLVM_CONFIG_EXECUTABLE           /usr/bin/llvm-config-3.7
    LLVM_LINK_EXECUTABLE             /usr/bin/llvm-link-3.7

but am met with the following CMake Error:

 CMake Error: The following variables are used in this project, but they
are set to NOTFOUND.
 Please set them or make sure they are set and tested correctly in the
CMake files:
 CLANG_LIB
     linked by target "gbe" in directory
/home/bpaterni/usr/src/beignet/backend/src
     linked by target "gbe" in directory
/home/bpaterni/usr/src/beignet/backend/src
     linked by target "gbe" in directory
/home/bpaterni/usr/src/beignet/backend/src
     .
     .
     .


Please let me know what I'm missing.

Thank You

On 03/02/2016 02:37 AM, Yang, Rong R wrote:
> Yes, In OpenCL 1.2, using double no longer requires using the pragma cl_khr_fp64. But clang support it from clang 3.7. 
> which llvm/clang version do you use? Could you update to llvm/clang 3.7 and try again?
> 
>> -----Original Message-----
>> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
>> Brian Paterni
>> Sent: Tuesday, March 1, 2016 22:36
>> To: beignet at lists.freedesktop.org
>> Subject: [Beignet] cl_khr_fp64 on OpenCL 1.2+
>>
>> Hi
>>
>> Since the latest beignet release (1.1.1) provided by debian does not support
>> double precision floating point, I ended up compiling from source and
>> installed the latest git code locally with EXPERIMENTAL_DOUBLE enabled.
>>
>> Successfully, clinfo does detect the cl_khr_fp64 extension. However, the
>> pyopencl framework I'm working with expects the extension to be included
>> as core functionality with OpenCL 1.2+. As an example, the attached minimal
>> python code (test-double-record.py) attempts to map a
>> numpy.float64 type to an OpenCL C struct, and in doing so, generates a
>> minimal kernel to test the struct (tmpvRXvhp.cl). As seen, the kernel only
>> enables cl_khr_fp64 if using OpenCL < 1.2, but since I'm using Beignet (opencl
>> 1.2), and cl_khr_fp64 is not part of core functionality, I'm met with the
>> following error as the generated kernel fails to compile:
>>
>>     Traceback (most recent call last):
>>       File "./test-double-record.py", line 14, in <module>
>>         numpy.dtype([('double_0', numpy.float64)]))
>>       File "<decorator-gen-3>", line 2, in match_dtype_to_c_struct
>>       File "/usr/lib/python2.7/dist-packages/pytools/__init__.py", line 430, in
>> _deco
>>         result = func(*args)
>>       File "/usr/lib/python2.7/dist-packages/pyopencl/tools.py", line 603, in
>> match_dtype_to_c_struct
>>         knl = prg.build(devices=[device]).get_size_and_offsets
>>       File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 213, in
>> build
>>         options=options, source=self._source)
>>       File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 253, in
>> _build_and_catch_errors
>>         raise err
>>     pyopencl.RuntimeError: clBuildProgram failed: build program failure -
>>
>>     Build on <pyopencl.Device 'Intel(R) HD Graphics 5500 BroadWell U-
>> Processor GT2' on 'Intel Gen OCL Driver' at 0x7f4163b190e0>:
>>
>>     stringInput.cl:14:3: error: use of type 'double' requires
>> cl_khr_fp64 extension to be enabled
>>
>>     (options: -I /usr/lib/python2.7/dist-packages/pyopencl/cl)
>>     (source saved as /tmp/tmpNQsE23.cl)
>>
>> Given the above, I'm wondering what the best resolution would be? Would a
>> request to add cl_khr_fp64 to Beignet's core be possible? Or would a better
>> solution exist where pyopencl does not assume cl_khr_fp64 core
>> functionality in OpenCL 1.2+?



More information about the Beignet mailing list