[cfe-dev] [RFC] New file extension for compiling C++ for OpenCL sources

Anastasia Stulova via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 17 10:56:37 PST 2021


Interesting observation.

> Is C++-with-OpenCL really so different from the situation with C++ today?

Right now we only have one version but it is very plausible that more will appear in the future.

Do I understand it correctly that you suggest the filename suffixes are not that useful and we should abandon the idea?

Then should this apply to all or some languages?

Aside from detecting the default compiler flags (even if not entirely)
I find extensions are quite useful to indicate in what language sources are written.

> Is there any appetite to create a driver alias such as "clangcl", analogous to what we do today with "clang++"?

We had no plans for this yet.

________________________________
From: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
Sent: 17 February 2021 16:36
To: Andrzej Warzynski <Andrzej.Warzynski at arm.com>
Cc: Anastasia Stulova <Anastasia.Stulova at arm.com>; cfe-dev at lists.llvm.org <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] [RFC] New file extension for compiling C++ for OpenCL sources

FWIW, as a complete outsider, as a complete non-user of OpenCL (but a heavy user of C++), I don't see why a new filename extension is a good thing. In the C++ world we've already had to deal with "same extension different language" for many years — you have a file named test.cpp, but you must still tell the compiler what language it's written in:
- via the driver name, e.g. clang vs. clang++
- via the -std= option, e.g. -std=c++03 vs. -std=c++20
The compiler generally can't guess just from the filename.
Is C++-with-OpenCL really so different from the situation with C++ today?
Is there any appetite to create a driver alias such as "clangcl", analogous to what we do today with "clang++"?

my very small $.02,
–Arthur


On Tue, Feb 16, 2021 at 12:39 PM Andrzej Warzynski via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
Interesting! :)

IMHO both:
.cxxcl/.cppcl
and
.clcxx/.clcpp
make it clear what the files contain. +1 from me for either of these (or
both).

Thank you for working on this Anastasia!

-Andrzej

On 16/02/2021 17:12, Anastasia Stulova wrote:
> I am not aware of non-clang implementations of OpenCL kernel language
> parsing. There are some forks of clang customizing the default behaviour
> though. But I am not aware of any customizing that specific functionality.
>
>
> ------------------------------------------------------------------------
> *From:* cfe-dev <cfe-dev-bounces at lists.llvm.org<mailto:cfe-dev-bounces at lists.llvm.org>> on behalf of Andrzej
> Warzynski via cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>
> *Sent:* 16 February 2021 16:42
> *To:* cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>
> *Subject:* Re: [cfe-dev] [RFC] New file extension for compiling C++ for
> OpenCL sources
> Is there any prior art? As in, what other compilers do? Or is Clang the
> precursor here?
>
> -Andrzej
>
> On 16/02/2021 16:27, MLJ1991 via cfe-dev wrote:
>> That seems like a good compromise
>>
>>> On Feb 16, 2021, at 8:26 AM, Anastasia Stulova
>>> <Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com> <mailto:Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com> <mailto:Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com>>>> wrote:
>>>
>>> Thanks! I see, I think .cl was meant to represent Compute Language as
>>> in OpenCL, I would somehow find it better if we don't split cl... I
>>> think that "cl" indicates more intuitively that it is OpenCL specific
>>> file. We could however use cppcl?
>>>
>>> ------------------------------------------------------------------------
>>> *From:*MLJ1991 <marcusljohnson1991 at gmail.com<mailto:marcusljohnson1991 at gmail.com>
>>> <mailto:marcusljohnson1991 at gmail.com<mailto:marcusljohnson1991 at gmail.com> <mailto:marcusljohnson1991 at gmail.com<mailto:marcusljohnson1991 at gmail.com>>>>
>>> *Sent:*16 February 2021 16:08
>>> *To:*Anastasia Stulova <Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com>
>>> <mailto:Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com> <mailto:Anastasia.Stulova at arm.com<mailto:Anastasia.Stulova at arm.com>>>>
>>> *Cc:*clang developer list <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
>>> <mailto:cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> <mailto:cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>>>; nd
> <nd at arm.com<mailto:nd at arm.com> <mailto:nd at arm.com<mailto:nd at arm.com> <mailto:nd at arm.com<mailto:nd at arm.com>>>>;
>>> Sven Van Haastregt <Sven.VanHaastregt at arm.com<mailto:Sven.VanHaastregt at arm.com>
>>> <mailto:Sven.VanHaastregt at arm.com<mailto:Sven.VanHaastregt at arm.com> <mailto:Sven.VanHaastregt at arm.com<mailto:Sven.VanHaastregt at arm.com>>>>
>>> *Subject:*Re: [cfe-dev] [RFC] New file extension for compiling C++ for
>>> OpenCL sources
>>> I mean, if .cl is the OpenCL C extension, logically the C++ extension
>>> should be .cxxl or .cppl
>>>
>>>> On Feb 16, 2021, at 7:41 AM, Anastasia Stulova via cfe-dev
>>>> <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> <mailto:cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> <mailto:cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> Up to now, we have used the same file extension for OpenCL C and C++
>>>> for OpenCL
>>>> (https://clang.llvm.org/docs/UsersManual.html#cxx-for-opencl
>>>> <https://clang.llvm.org/docs/UsersManual.html#cxx-for-opencl
> <https://clang.llvm.org/docs/UsersManual.html#cxx-for-opencl>>). But
>>>> to keep
>>>> consistency with the clang driver interface, it makes more sense that
>>>> C++ for OpenCL
>>>> has a different extension from OpenCL C. Mirroring C and C++ it would
>>>> be logical to
>>>> support the following:
>>>>
>>>> .cl - OpenCL C source file
>>>> .clcpp - C++ for OpenCL source file
>>>>
>>>> I would like to share the review that adds a new file extension for
>>>> C++ for OpenCL with
>>>> a wider audiencehttps://reviews.llvm.org/D96771<http://reviews.llvm.org/D96771>
>>>> <https://reviews.llvm.org/D96771 <https://reviews.llvm.org/D96771>>. Feel
> free to provide us any feedback
>>>> regarding the direction or implementation details.
>>>>
>>>> Kind regards,
>>>> Anastasia
>>>> _______________________________________________
>>>> cfe-dev mailing list
>>>> cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> <mailto:cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org> <mailto:cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>>
>>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>>>> <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>>
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
> <https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210217/a0636faa/attachment-0001.html>


More information about the cfe-dev mailing list