Bug 91130 - Mesa's cl.h defines CL_VERSION_1_2 even though it is missing some OpenCL 1.2 functions
Summary: Mesa's cl.h defines CL_VERSION_1_2 even though it is missing some OpenCL 1.2 ...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: 10.5
Hardware: Other All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2015-06-27 21:39 UTC by Dennis Schridde
Modified: 2015-09-01 08:03 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description Dennis Schridde 2015-06-27 21:39:11 UTC
`clEnqueueFillBuffer` is part of OpenCL 1.2 [1] [2].

Mesa claims to support OpenCL 1.2:
# grep -B1 CL_VERSION /usr/include/CL/cl.h
/* OpenCL Version */
#define CL_VERSION_1_0                              1
#define CL_VERSION_1_1                              1
#define CL_VERSION_1_2                              1

It declares `clEnqueueFillBuffer`:
# grep -B1 -A8 clEnqueueFillBuffer /usr/include/CL/cl.h
extern CL_API_ENTRY cl_int CL_API_CALL
clEnqueueFillBuffer(cl_command_queue   /* command_queue */,
                    cl_mem             /* buffer */, 
                    const void *       /* pattern */, 
                    size_t             /* pattern_size */, 
                    size_t             /* offset */, 
                    size_t             /* size */, 
                    cl_uint            /* num_events_in_wait_list */, 
                    const cl_event *   /* event_wait_list */, 
                    cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_2;

But does not define it:
# scanelf -s clEnqueueFillBuffer /usr/lib/libOpenCL.so
ET_DYN  -  /usr/lib/libOpenCL.so 

Logically, it also seems to be missing in the API dispatcher [1].

I assume Mesa should not claim to support OpenCL 1.2 via `CL_VERSION_1_2`, if at least one of the OpenCL 1.2 functions is not implemented.

[1]: https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueFillBuffer.html
[2]: https://www.khronos.org/registry/cl/specs/opencl-1.2.pdf#page=85
[3]: http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/clover/api/dispatch.cpp#n129
Comment 1 Dennis Schridde 2015-06-27 21:40:40 UTC
This issue turned up when trying to fix a linker error in JTR: https://github.com/magnumripper/JohnTheRipper/issues/1470
Comment 2 Serge Martin 2015-07-28 13:11:12 UTC

this should be mitigated with the "clover: allow the creation of Piglit tests for the missing CL 1.2 fonction" serie available on mesa-dev list.

However, even if the program will compile, those fonctions are stubs for the moment. Also applications should ensure that OpenCL 1.2 is available on the platform, for the moment CLover only claim "OpenCL 1.1". For exemple, the platform report currently report "OpenCL 1.2 MESA 10.7.0-devel" in ToT.

Comment 3 Serge Martin 2015-07-28 13:17:27 UTC
Sorry I mean "OpenCL 1.1 MESA 10.7.0-devel". 1.2 is only clain on my local tree
Comment 4 Dennis Schridde 2015-07-28 14:56:00 UTC
Just to make sure I understand. You say that:
1) Mesa should provide a shared library that actually implements all functions advertised in the header (which will be fixed in Mesa 10.7/11.0)
2) applications using OpenCL should still check at runtime which features are available

I believe JTR already does the latter (there are instances of `if (ocl_ver >= 120)` in the source). So once the patch for (1) is merged, this issue should be fixed.

For reference: The patch Serge mentioned can be found at: https://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg88849.html
Comment 5 Serge Martin 2015-09-01 08:03:32 UTC
This should by fix by a97f1b697b01dca9f72d8559f8269188d76dccc9 : clover: Stub missing CL 1.2 functions.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.