Skip to content

[SYCL] Add namespace alias for cl::sycl namespace #969

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

Closed
wants to merge 1 commit into from

Conversation

bader
Copy link
Contributor

@bader bader commented Dec 24, 2019

The alias is enabled by default and make using SYCL API a little bit
easier.

Unfortunately it's not compatible with the following valid C++ code:

namespace sycl {
  using namespace cl::sycl;
}

In order to disable namespace alias user should define
__SYCL_DISABLE_NAMESPACE_ALIAS__ macro.

Signed-off-by: Alexey Bader [email protected]

The alias is enabled by default and make using SYCL API a little bit
easier.

Unfortunately it's not compatible with the following valid C++ code:

namespace sycl {
  using namespace cl::sycl;
}

In order to disable namespace alias user should define
__SYCL_DISABLE_NAMESPACE_ALIAS__ macro.

Signed-off-by: Alexey Bader <[email protected]>
@keryell
Copy link
Contributor

keryell commented Dec 26, 2019

This seems dangerous.
If you want to use some alternate namespaces, why not including alternate headers instead of breaking existing code since you decide anyway to change the code to use for example ::sycl instead of cl::sycl::
Look at for example https://github.com/triSYCL/triSYCL/blob/master/tests/sycl_namespace/demo_parallel_matrix_add.cpp

@bader bader deleted the sycl-namespace-alias branch December 28, 2019 11:40
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Feb 23, 2023
Renamed `acc` to `accelerator` and removed from the tests where possible.
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.

3 participants