This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Supports optional generic address space sematics in C++ for OpenCL 2021
ClosedPublic

Authored by Topotuna on Aug 20 2021, 5:55 AM.

Details

Summary

Adds support for a feature macro __opencl_c_generic_address_space
in C++ for OpenCL 2021 enabling a respective optional core feature
from OpenCL 3.0. Testing is only performed in SemaOpenCL because
generic address space functionality is yet to be implemented in
C++ for OpenCL 2021.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

Diff Detail

Event Timeline

Topotuna created this revision.Aug 20 2021, 5:55 AM
Topotuna requested review of this revision.Aug 20 2021, 5:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2021, 5:55 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Anastasia added inline comments.Aug 23 2021, 2:35 AM
clang/lib/Headers/opencl-c-base.h
33 ↗(On Diff #367771)

I think we should just check here that C++ for OpenCL version is 1.0 so the same as for OpenCL C 2.0 because the same logic applies to it.

Topotuna planned changes to this revision.Aug 23 2021, 7:12 AM

__opencl_c_generic_address_space should not have been chosen as the first feature to be addressed out of all OpenCL 3.0 optional core features. This is because __opencl_c_device_enqueue has a dependency on this feature. I will review the order in which OpenCL 3.0 optional features should be introduced to C++ for OpenCL 2021 and return to this revision when all dependencies are resolved.

__opencl_c_generic_address_space should not have been chosen as the first feature to be addressed out of all OpenCL 3.0 optional core features. This is because __opencl_c_device_enqueue has a dependency on this feature. I will review the order in which OpenCL 3.0 optional features should be introduced to C++ for OpenCL 2021 and return to this revision when all dependencies are resolved.

Ok, although it makes sense to add generic address space as multiple other features depend on this and we can unblock more work. Also I think __opencl_c_device_enqueue is being worked on by someone already but it is still not complete.

Topotuna updated this revision to Diff 369913.Sep 1 2021, 6:20 AM
Topotuna retitled this revision from [OpenCL] Supports optional generic address space in C++ for OpenCL 2021 to [OpenCL] Supports optional generic address space sematics in C++ for OpenCL 2021.
Topotuna edited the summary of this revision. (Show Details)

The previously suggested change was split into intermediate steps:
reviews.llvm.org/rGf9bc1b3bee55 - introduced a mapping function for C++ for OpenCL version compatibility with OpenCL and modified condition for setting OpenCLGenericAddressSpace language option.
reviews.llvm.org/rGfb321c2ea274 - enabled all OpenCL 3.0 optional core feature macros without implementing their support in C++ for OpenCL 2021.

This change only enables semantics for optional generic address space although actual functionality is not yet implemented in C++ for OpenCL 2021.

Anastasia accepted this revision.Sep 1 2021, 10:22 AM

LGTM! Thanks

clang/lib/Basic/TargetInfo.cpp
413–415

Ok, I am guessing this will be changed back to one check later on?

This revision is now accepted and ready to land.Sep 1 2021, 10:22 AM
Topotuna marked an inline comment as done.Sep 6 2021, 1:29 AM
Topotuna added inline comments.
clang/lib/Basic/TargetInfo.cpp
413–415

Yes, the change that removes this check is already put for review: D109306

This revision was landed with ongoing or failed builds.Sep 6 2021, 2:21 AM
This revision was automatically updated to reflect the committed changes.
Topotuna marked an inline comment as done.