-
Notifications
You must be signed in to change notification settings - Fork 770
[SYCL] Refactor cl::sycl namespace. Part1 #4397
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
Conversation
@erichkeane Could you please take a look at |
Clang changes so far are seemingly fine. You might consider removing one set of '{' and '}' from it though so that the source looks something like:
.... Or something. It would at least make the scoping a little easier to read. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed half of the changed files and left a few comments.
Could you clarify how many parts of the refactoring is going to be and give an overview of the changes in other parts, please?
sycl/include/sycl/ext/intel/experimental/esimd/detail/host_util.hpp
Outdated
Show resolved
Hide resolved
I see it like this:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments for the second half of the files.
|
||
#ifdef __SYCL_ENABLE_SYCL121_NAMESPACE | ||
// Old SYCL1.2.1 namespace scheme | ||
#define __SYCL_NS_OPEN_1 __SYCL_INLINE_NAMESPACE(cl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove __SYCL_INLINE_NAMESPACE
? I think it's not supposed to be used explicitly anymore. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still used for builtins declaration - https://github.com/intel/llvm/blob/sycl/sycl/include/CL/sycl/detail/builtins.hpp#L106 and will be used until we remove support for old namespaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will get rid of this macro in the second patch(by introducing a new one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is still used for builtins declaration - https://github.com/intel/llvm/blob/sycl/sycl/include/CL/sycl/detail/builtins.hpp#L106 and will be used until we remove support for old namespaces.
#ifndef __SYCL_DEVICE_ONLY__
__SYCL_INLINE_NAMESPACE(cl) {
namespace __host_std {
I think we should re-visit the design of this code.
It is unclear to me why we put built-in declarations to cl
namespace. Another question: why do we inline cl
namespace here? I understand that it's needed to allow users to use sycl
namespace w/o cl::
qualifier, but __host_std
namespace should not be exposed like this. Right?
Will get rid of this macro in the second patch(by introducing a new one).
Could you clarify what new macro is for?
If this is the only use, can we just use inline namespace
instead of the macro here? I'm okay to make this change in follow-up patches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FPGA file changes are LGTM
53d3767
bfloat16 fail should be fixed by #4388 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FE changes LGTM
@@ -4788,8 +4788,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) { | |||
FwdDeclEmitter.Visit(K.NameType); | |||
O << "\n"; | |||
|
|||
O << "__SYCL_INLINE_NAMESPACE(cl) {\n"; | |||
O << "namespace sycl {\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found a problem with this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the integration header includes defines_elementary.hpp
which selects either SYCL 1.2.1 of SYCL2020 style of namespaces before we know which one should be used. So, it seems it was a bad idea to use the same macro in the integration header and for headers. Going to introduce a separate macro for integration header.
@erichkeane @premanandrao Does it sound OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like that should be alright... we just have to make sure the two stay in sync. Though, I'm not sure how you can get a macro here to work if it depends on a decision that isn't made yet. Should defines_elementary.hpp
be doing all of the lifting for this set of namespaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use inline namespace cl
w/o any macro defined in DPC++ headers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like that should be alright... we just have to make sure the two stay in sync.
Though, I'm not sure how you can get a macro here to work if it depends on a decision that isn't made yet.
Should defines_elementary.hpp be doing all of the lifting for this set of namespaces?
I'm thinking about separating those namespaces. For integration header we could have a macro in the defines_elementary.hpp
which, for example, defines to __sycl_int_header_ns
(it's not quite suitable for the integration footer though). For headers we could you an additional header(defines_sycl_ns.hpp
) which is not included from the integration header - when we include it we know which namespace version we should use.
Can we just use inline namespace cl w/o any macro defined in DPC++ headers?
We can, but we cannot use inline namespace cl
, because user space will be still poluted. We can use a different namespace - __sycl_int_header_ns
, but with a macro it would be easier to be in sync without FE modifications.
Please, update the PR title to something like "[SYCL] Refactor cl::sycl namespace [part 1 of 3]." and add the details from your comment to the description. |
The patch is the first in series of patches that implement support for
SYCL2020 namespace requirements - sycl:: instead of cl::sycl.
The patch replaces explicit uses of cl::sycl namespace with a configurable
macro which will be used in future patches.