Skip to content

Support for new namespace #4460

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 64 commits into from

Conversation

romanovvlad
Copy link
Contributor

@romanovvlad romanovvlad commented Sep 2, 2021

This patch aims to remove cl:: namespace from sycl/sycl.hpp header.
Currently sycl/sycl.hpp exposes SYCL API in cl::sycl namespace. It needs to be changed to just sycl:: so the user code which includes this header and accesses something using cl::sycl should produce an error.

The patch moves all SYCL APIs to a new __sycl_internal namespace and imports API from it to cl::sycl if CL/sycl.hpp in included or just to sycl in case of sycl/sycl.hpp:

namespace __sycl_internal {
  class buffer;
  ...
}
namespace sycl {
  using namespace __sycl_internal;
}

FE and llvm passes are updated accordingly to check for new namespace where it's needed.
In order to keep backward compatibility the patch adds aliases for each exported function from cl::sycl namespace to __sycl_internal namespace.

The patch is going to be committed in several pieces:

  1. Introduce a macro which will be defined to old namespace(cl::sycl)
  2. Change FE to recognize SYCL entities from both cl::sycl and __sycl_internal namespaces and start using the macro during integration header/footer instead of cl::sycl
  3. Similar to 2), but for llvm passes
  4. Change all usages of cl::sycl with usages of the macro
  5. Replace cl::sycl with __sycl_ns (which at this stage will be the same)
  6. Work with exceptions
  7. Change macro to use new namespaces and update tests

@denis-kabanov
Copy link
Contributor

/summary:run

@denis-kabanov
Copy link
Contributor

/summary:run

@denis-kabanov
Copy link
Contributor

/summary:run

@denis-kabanov
Copy link
Contributor

/summary:run

@github-actions github-actions bot added the Stale label Apr 28, 2022
@github-actions github-actions bot closed this May 29, 2022
@bader bader reopened this May 29, 2022
@pvchupin pvchupin requested a review from aelovikov-intel June 8, 2022 00:07
@github-actions github-actions bot closed this Jul 8, 2022
@bader bader reopened this Jul 8, 2022
@bader bader removed the Stale label Jul 8, 2022
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 2023
Remove #include of "CL/sycl/access/access.hpp" and
"CL/sycl/access/access.hpp" for several reasons:
1)The new approach of namespaces (PR intel#4460) relies on the fact
   that users include high level header(e.g. CL/sycl.hpp or
   sycl/sycl.hpp) to resolve final namespaces, so including internal
   headers directly(especially before high level headers) breaks this
   approach.
2)The spec doesn't specify names of internal headers, so it's illegal
   and non-portable to include any other header that high level ones.
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