[clang] [Clang] Add support for missing OpenCL extensions (PR #129777)

Sven van Haastregt via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 5 08:33:22 PST 2025


svenvh wrote:

> @svenvh, I'm trying to unify the extensions enablement in the user interface. We can enable or disable some of the extensions with the `-Xclang -cl-ext=+extension` command line options. For example, a user can pass `-Xclang -cl-ext=+cl_khr_subgroups` successfully, but the `-Xclang -cl-ext=+cl_khr_subgroup_ballot` has no effect on the compiler.

Got it, thanks for looking into this!

I'm trying to refresh my memory on this, as this is something Anton, Anastasia and myself looked at back in 2021, but we never concluded the work.  From [the most recent discussion I could find on this topic](https://discourse.llvm.org/t/spir-target-enables-all-cl-optional-extensions/58587/5), I think the consensus was that for header-only extensions given to `-cl-ext` (such as `-cl-ext=+cl_khr_subgroup_ballot`) clang should just define the corresponding macro (`-Dcl_khr_subgroup_ballot`), probably in `TargetInfo::setCommandLineOpenCLOpts`.  That way, header-only extensions don't need to be added to `OpenCLExtensions.def`

https://github.com/llvm/llvm-project/pull/129777


More information about the cfe-commits mailing list