This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Switch to C++17
ClosedPublic

Authored by Anastasia on May 3 2019, 7:02 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

Anastasia created this revision.May 3 2019, 7:02 AM
kpet added inline comments.May 3 2019, 7:38 AM
include/clang/Frontend/LangStandards.def
162 ↗(On Diff #197996)

Suggest you add HexFloat as well. It is part of c++17 and all OpenCL versions.

keryell added a subscriber: keryell.May 3 2019, 2:33 PM
keryell added inline comments.
include/clang/Frontend/LangStandards.def
162 ↗(On Diff #197996)

Why only C++17?
I would love to have CPlusPlus2a here too...

rsmith added a subscriber: rsmith.May 3 2019, 3:54 PM

Per the OpenCL C++ 1.0 specification, section 2:

The OpenCL C++ programming language is based on the ISO/IEC JTC1 SC22 WG21 N 3690 language specification (a.k.a. C++14 specification).

I think it would be reasonable to permit changing the base C++ standard in OpenCL C++ mode, but we'd need a good reason to deviate from the behavior specified in the OpenCL C++ specification by default.

Anastasia marked an inline comment as done.May 7 2019, 2:56 AM

Per the OpenCL C++ 1.0 specification, section 2:

The OpenCL C++ programming language is based on the ISO/IEC JTC1 SC22 WG21 N 3690 language specification (a.k.a. C++14 specification).

I think it would be reasonable to permit changing the base C++ standard in OpenCL C++ mode, but we'd need a good reason to deviate from the behavior specified in the OpenCL C++ specification by default.

I am in discussion with Khronos about changing the directions for this spec and I believe some announcements will appear hopefully soon.

include/clang/Frontend/LangStandards.def
162 ↗(On Diff #197996)

I would love to have C++2a too but it's currently an experimental feature only and I can't see any timeline about when this will become production quality. As we are planning to release C++ for OpenCL in production quality during this year I am afraid it won't be possible to include C++2a at this point .

Perhaps this is something we can do in the future.

Per the OpenCL C++ 1.0 specification, section 2:

The OpenCL C++ programming language is based on the ISO/IEC JTC1 SC22 WG21 N 3690 language specification (a.k.a. C++14 specification).

I think it would be reasonable to permit changing the base C++ standard in OpenCL C++ mode

Indeed! There should be an option to pick the version of C++ the user wants for OpenCL.

Per the OpenCL C++ 1.0 specification, section 2:

The OpenCL C++ programming language is based on the ISO/IEC JTC1 SC22 WG21 N 3690 language specification (a.k.a. C++14 specification).

I think it would be reasonable to permit changing the base C++ standard in OpenCL C++ mode

Indeed! There should be an option to pick the version of C++ the user wants for OpenCL.

Unfortunately, this is not easy to do. We document changes on top of other spec and we need to provide references. It would be a lot more work to refer to all different spec versions of C++. Also the development becomes more complicated as it needs testing and fixing against all different C++ versions. It makes sense to focus on one version and potentially provide an upgrade in the future. Also C++17 is a reasonable target most of developers should be happy with at this point.

Anastasia updated this revision to Diff 198627.May 8 2019, 4:57 AM

Added HexFloat!

kpet accepted this revision.May 8 2019, 5:27 AM

LGTM.

This revision is now accepted and ready to land.May 8 2019, 5:27 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2019, 4:55 AM