Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sycl = ::cl::sycl namespace alias #108

Merged
merged 1 commit into from
Jul 1, 2021

Conversation

psalz
Copy link
Member

@psalz psalz commented Apr 13, 2021

SYCL 2020 introduces a new canonical namespace, ::sycl, which is defined within the new <sycl/sycl.hpp> header. To ease the transition of the CTS to the new namespace, this creates an alias sycl = cl::sycl, while keeping the SYCL 1.2.1 header path <CL/sycl.hpp> for the time being.

For the record, I also tried going the reverse route, i.e., including <sycl/sycl.hpp>, and defining namespace cl { namespace sycl = ::sycl; }. However that didn't work, as DPC++ already exports that alias (while e.g. hipSYCL doesn't - the spec isn't super clear on this), and ComputeCpp 2.4 doesn't seem to support the new header at all.

SYCL 2020 introduces a new canonical namespace, ::sycl, which is defined
within the new <sycl/sycl.hpp> header. To ease the transition of the CTS
to the new namespace, this creates an alias `sycl = cl::sycl`, while
keeping the SYCL 1.2.1 header path <CL/sycl.hpp> for the time being.
@bader bader added the Agenda To be discussed during a SYCL committee meeting label Apr 13, 2021
@bader bader self-requested a review April 13, 2021 16:25
@psalz psalz mentioned this pull request Apr 14, 2021
@bader
Copy link
Contributor

bader commented Apr 15, 2021

To clarify: I've added "Agenda" tag to discuss this description section:

For the record, I also tried going the reverse route, i.e., including <sycl/sycl.hpp>, and defining namespace cl { namespace sycl = ::sycl; }. However that didn't work, as DPC++ already exports that alias (while e.g. hipSYCL doesn't - the spec isn't super clear on this), and ComputeCpp 2.4 doesn't seem to support the new header at all.

@keryell
Copy link
Member

keryell commented Apr 20, 2021

This would work with triSYCL.

@bader
Copy link
Contributor

bader commented Apr 21, 2021

This would work with triSYCL.

@keryell, can we interpret this comment as "Approved" from your side? :)

@keryell
Copy link
Member

keryell commented Apr 22, 2021

This would work with triSYCL.

@keryell, can we interpret this comment as "Approved" from your side? :)

Not really.
In theory yes for careful implementation with small footprint not trying to pollute all the namespaces around. :-)
Do you plan to update DPC++ accordingly to reduce its namespace pollution?
Perhaps we can discuss this inside the SYCL committee meeting.

@keryell keryell added the Agenda To be discussed during a SYCL committee meeting label Apr 22, 2021
@keryell
Copy link
Member

keryell commented May 4, 2021

I have the feeling that a CTS should test exactly what is in the spec and not define some aliases or new indirect namespaces because it might have some side effect, like noticed by @psalz.

@keryell
Copy link
Member

keryell commented May 4, 2021

Do we need to validate in the CTS that cl::sycl works as a deprecated compatibility mode?
I do not think we need.
Then, why not just changing in the CTS 2020 all the cl::sycl:: by sycl:: and do not set up an alias?

@psalz
Copy link
Member Author

psalz commented May 6, 2021

Then, why not just changing in the CTS 2020 all the cl::sycl:: by sycl:: and do not set up an alias?

That is of course also an option, I just thought that a more gradual change would reduce noise in the repo history. But it's all the same to me, really.

@keryell
Copy link
Member

keryell commented May 8, 2021

By looking at it again:

For the record, I also tried going the reverse route, i.e., including <sycl/sycl.hpp>, and defining namespace cl { namespace sycl = ::sycl; }. However that didn't work, as DPC++ already exports that alias (while e.g. hipSYCL doesn't - the spec isn't super clear on this), and ComputeCpp 2.4 doesn't seem to support the new header at all.

is the right hack to use for now, before changing globally cl::sycl:: to sycl::.
DPC++ should not pollute the global namespace and ComputeCpp should support <sycl/sycl.hpp>, right?

@keryell keryell removed the Agenda To be discussed during a SYCL committee meeting label Jul 1, 2021
@bader bader merged commit 71371e8 into KhronosGroup:SYCL-2020 Jul 1, 2021
@psalz psalz deleted the alias-sycl-namespace branch September 7, 2021 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants