This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Fix parsing of opencl-c.h in CL 3.0 with device-scope atomics enabled
Needs ReviewPublic

Authored by kpet on Aug 19 2021, 10:32 AM.

Details

Reviewers
Anastasia
Summary

Also declare and test the opencl_c_atomic_scope_device and
opencl_c_atomic_scope_all_devices features. The header is testing for them
but they were never defined by Clang.

With the new features declared, test/Headers/opencl-c-header.cl does
exercise the declaration this change fixes.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>

Diff Detail

Event Timeline

kpet created this revision.Aug 19 2021, 10:32 AM
kpet requested review of this revision.Aug 19 2021, 10:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2021, 10:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Anastasia added inline comments.
clang/include/clang/Basic/OpenCLExtensions.def
113

Do we need to add anything to clang for those features? If not they should just go into the headers, see guidelines https://clang.llvm.org/docs/OpenCLSupport.html#implementation-guidelines

CC @azabaznov

clang/lib/Headers/opencl-c.h
13381

This is a fairly trivial fix. You can just commit it straight away if you like. :)

kpet added inline comments.Nov 4 2021, 7:19 AM
clang/lib/Headers/opencl-c.h
13381

I've committed the fix alone as b8b6a5bc86f570a6fb94b88b8c9d634c3af71eca.

azabaznov added inline comments.Nov 4 2021, 8:49 AM
clang/include/clang/Basic/OpenCLExtensions.def
114

Oops, sorry I missed that. @Anastasia, I think this one is header only. We discussed that here: https://reviews.llvm.org/D103241. We should either extend -cl-ext for unknown features (finally) or use it as -D__opencl_c_atomic_scope_all_devices