Skip to content

[SYCL] Move implementation details under sycl_private namespace #1311

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

Conversation

alexbatashev
Copy link
Contributor

@alexbatashev alexbatashev commented Mar 13, 2020

ABI tests require a way to differentiate private and publicly accessible
symbols. Wrap symbols that are not be accessible from user application
in sycl_private namespace to exclude them from ABI checks.

Signed-off-by: Alexander Batashev [email protected]

Alexander Batashev and others added 4 commits March 11, 2020 18:24
ABI tests require a way to differentiate private and publicly accessible
symbols. Wrap private symbols in sycl_private namespace to exclude them
from ABI checks.

Signed-off-by: Alexander Batashev <[email protected]>
…_private

* origin/sycl:
  [SYCL][NFC] Fix static code analysis concerns (intel#1283)
  [SYCL] Fix the test/basic_tests/buffer/subbuffer.cpp (intel#1277)
Signed-off-by: Alexander Batashev <[email protected]>
@bader
Copy link
Contributor

bader commented Mar 13, 2020

What is "private symbol"?
How can I decide which symbol is private?

@alexbatashev
Copy link
Contributor Author

What is "private symbol"?
How can I decide which symbol is private?

Does it sound better now?

@bader
Copy link
Contributor

bader commented Mar 13, 2020

We have "detail" namespace for "implementation details".
How can I decide which symbol should be "sycl_private" namespace and which symbol in "detail"?

@alexbatashev
Copy link
Contributor Author

We have "detail" namespace for "implementation details".
How can I decide which symbol should be "sycl_private" namespace and which symbol in "detail"?

detail is used for many things across the project. It hides both host- and device-side implementation details, and user application still link againts those symbols. sycl_private only wraps the contents of source directory: those symbols can not be accessed from user applications, because the declarations are unknown.

@bader
Copy link
Contributor

bader commented Mar 13, 2020

What is wrong with anonymous namespace?
Can we use it to hide symbols?

@bader
Copy link
Contributor

bader commented Mar 13, 2020

sycl_private only wraps the contents of source directory: those symbols can not be accessed from user applications, because the declarations are unknown.

I see sycl_private uses in SYCL headers. Is this intentional?

@alexbatashev
Copy link
Contributor Author

sycl_private only wraps the contents of source directory: those symbols can not be accessed from user applications, because the declarations are unknown.

I see sycl_private uses in SYCL headers. Is this intentional?

Yes, we still need to keep pointers to impl object. To fill in template arguments I needed forward declarations of classes. But pointers and forward declarations are not linkable symbols, so, those are not really "uses". And we still have a differentiation between accessible and inaccessible pieces of code.

@bader
Copy link
Contributor

bader commented Mar 16, 2020

What is wrong with anonymous namespace?
Can we use it to hide symbols?

@alexbatashev, could you answer these questions, please?

@alexbatashev
Copy link
Contributor Author

What is wrong with anonymous namespace?
Can we use it to hide symbols?

@alexbatashev, could you answer these questions, please?

I doubt I can reliably filter out everything that is inside cl::sycl::detail::(anonymous) namespace, but I’ll experiment a bit more with that.

@alexbatashev
Copy link
Contributor Author

What is wrong with anonymous namespace?
Can we use it to hide symbols?

@bader while I can reliably detect anonymous namespaces on Linux, Windows is a bit trickier. But that's not the main problem. The main problem is that anonymous namespace implies internal linkage. And it breaks our tests:

In file included from /repos/sycl_private/sycl/unittests/scheduler/MemObjCommandCleanup.cpp:10:
/repos/sycl_private/sycl/unittests/scheduler/SchedulerTestUtils.hpp:76:6: error: function 'addEdge' is used but not defined in this translation unit, and cannot be defined in any other translation unit because its type does not have linkage

Can we keep sycl_private?

@alexbatashev alexbatashev deleted the private/abatashe/sycl_private branch September 17, 2021 06:45
aelovikov-intel pushed a commit to aelovikov-intel/llvm that referenced this pull request Feb 23, 2023
…SION (intel#1311)

[SYCL][Matrix] Replace SYCL_EXT_ONEAPI_MATRIX with SYCL_EXT_ONEAPI_MATRIX_VERSION

Related to intel#6957

Signed-off-by: Sidorov, Dmitry <[email protected]>
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