[cfe-dev] SPIR target enables all CL optional extensions

Anastasia Stulova via cfe-dev cfe-dev at lists.llvm.org
Wed Jul 7 05:36:23 PDT 2021

Correct some of the feature macros that add features through the libraries are
now unconditionally defined in the internal header files. Although clang was
always setting all optional features to supported ones for generic targets like
SPIR however there was a frontend-only flag '-cl-ext' that allowed to override

We have started the discussion to restore this functionality for library-based
features and here are two short-term approaches that have been discussed so

1. Use '-D__undef_<feature name>' flag to skip defining the macros. I have
created an RFC patch to demonstrate the idea earlier:

2. Extend '-cl-ext' interface to handle such features.
Anton has been looking at this in:

Overall, originally SPIR has been added to clang as a device-agnostic target in
a primary use case. But I feel in a long term we should consider improving the
design by adding an ability to specify a concrete device or maybe a class of
devices compiled for. Otherwise, I don't think always enumerating the list of
features/extensions using '-cl-ext'/'-D' with each clang invocation is extremely
usable. So this area definitely needs some improvements.

FYI this topic is being discussed in the scope of OpenCL Tooling
teleconferences within Khronos. The next session is on Thu next week.


From: David Airlie <airlied at redhat.com>
Sent: 07 July 2021 05:00
To: cfe-dev (cfe-dev at lists.llvm.org) <cfe-dev at lists.llvm.org>; Anastasia Stulova <Anastasia.Stulova at arm.com>; anton.zabaznov at intel.com <anton.zabaznov at intel.com>
Subject: Re: SPIR target enables all CL optional extensions

On Wed, Jul 7, 2021 at 1:29 PM David Airlie <airlied at redhat.com> wrote:
> Hi,
> I'm trying to bring back up the mesa CL 3.0 support at the moment, and
> running into a problem I'm not sure how to solve.

Jesse set me straight on irc.

sprinkling a bunch of these around gets me going.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210707/4eadfe30/attachment-0001.html>

More information about the cfe-dev mailing list