Issue 71655
Summary OpenCL C source that does not use image functions cannot be compiled on OpenCL 3.0 devices without image support
Labels
Assignees
Reporter Oblomov
    This issue was discovered with PoCL updating their CUDA device support to OpenCL 3.0, as reported [in this PoCL issue](https://github.com/pocl/pocl/issues/1339). The PoCL CUDA device does not support images, so it does not define the `__opencl_c_images` extension.

As a result, when `opencl-c.h` is included to build *any* device code (even device code that does not make use of image functions or types), the compilation produces 172 errors to the tune of
```
error: /usr/local/lib/../share/pocl/include/opencl-c.h:15178:46: use of type '__read_only image2d_t' requires __opencl_c_images support
```

This has been observed with LLVM 14, 15 and 16 at least.

I believe this is due to the “core” image functions in `opencl-c.h` being declared without proper fencing. The whole section of the header should be fenced by an
```
#if defined(__IMAGE_SUPPORT__) || defined(__opencl_c_images)
```
or similar.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to