This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] opencl-c.h: add __opencl_c_images and __opencl_c_read_write_images
ClosedPublic

Authored by airlied on Aug 5 2021, 1:17 AM.

Details

Summary

This wraps the image and rw images usages in the correct macros

Diff Detail

Event Timeline

airlied created this revision.Aug 5 2021, 1:17 AM
airlied requested review of this revision.Aug 5 2021, 1:17 AM
airlied updated this revision to Diff 364395.Aug 5 2021, 2:41 AM

found a few more places to replace these and fix them up. there might still be some strays in there.

airlied updated this revision to Diff 364396.Aug 5 2021, 2:46 AM

missed a couple of hunks.

LGTM! Thanks.

CC to @azabaznov for any final feedback.

FYI this has not been officially announced but in clang-14 we would like to transition away from using the huge hard to maintain opencl-c.h in favour of a more concise and fast to parse Tablegen based approach to declare builtin functions: https://clang.llvm.org/docs/OpenCLSupport.html#opencl-builtins. As a matter of fact to mature Tablegen-based solution it has been enabled by default in clang-13 without any extra flags https://clang.llvm.org/docs/UsersManual.html#opencl-header. And it is therefore now a primary header exposed to the application developer in upstream clang.

Since there has not been an announcement yet we don't make it a hard requirement yet but it is highly encouraged to mirror any new functionality into OpenCLBuiltins.td. Conditioning functions as in this patch is usually quite straightforward, it just needs an extra clause around builtin declarations:

let Extension = <extension or feature name> in {
 ...
}

And new features/extensions can be registered with:

def <Name>     : FunctionExtension<"macro_name1 macro_name2 ...">;

Here is one example that illustrates the idea https://reviews.llvm.org/D106434

Tablegen-header has full functionality of OpenCL 2.0 so it should be possible to extend it to OpenCL 3.0 without significant effort.

Both me and @svenvh would be happy to provide more information and review should you decide to help mantaining Tablegen-header in sync with new changes.

airlied updated this revision to Diff 364919.Aug 6 2021, 6:14 PM

fixed issues with check-clang, might need some follow up changes.

Anastasia accepted this revision.Aug 19 2021, 2:14 AM

LGTM! Thanks

This revision is now accepted and ready to land.Aug 19 2021, 2:14 AM

@airlied are you still planning to land this? I started looking at the corresponding .td changes when I realized we don't use __opencl_c_read_write_images in opencl-c.h either yet. :-)

This revision was landed with ongoing or failed builds.Jan 20 2022, 3:51 PM
This revision was automatically updated to reflect the committed changes.

Thanks for committing this! The corresponding TableGen changes are in D117899.