-
Notifications
You must be signed in to change notification settings - Fork 786
[SYCL] Add local_accessor and deprecate target::local #6341
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
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'm sorry for the delayed review.
sycl/include/CL/sycl/accessor.hpp
Outdated
class __SYCL_SPECIAL_CLASS __SYCL2020_DEPRECATED( | ||
"'accessor' with 'target::local' is deprecated: use 'local_accessor' " | ||
"instead.") accessor<DataT, Dimensions, AccessMode, access::target::local, | ||
IsPlaceholder> : |
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.
Unfortunately [[deprecated]] attribute doesn't work on template specializations: https://godbolt.org/z/nx56bsfjz
Deprecation message is not generated.
Another problem is that even if you deprecate this template specialization then I believe usage of local_accessor alias will result in deprecated message as well, isn't it?
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.
Okay, that is a bit of an issue. I think a possible solution could be to deprecate the class constructors instead of the class itself.
The only way I can think of to resolve the alias of local_accessor
producing a deprecated message is to create a new class just for local_accessor
.
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.
Indeed this seems to be very unpleasant issue, I'm sorry.
Other possible option is just to not add [[deprecated]] attribute in this patch if we are ok with absence of deprecation message. @steffenlarsen Do you think it is ok to not emit deprecation warning in this case? Since emitting a deprecation warning in this case causes too much headache and it seems to be only usability issue.
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 would definitely prefer that we deprecate the API explicitly, but you are right that we cannot deprecate specializations.
That said, SYCL 2020 deprecated select members of target
, local
included, so what I suggest is:
- Deprecate
access::target::local
. - Move the implementation in this specialization into a new
local_accessor
class. - Make
local_accessor
a base class of thisaccessor
specialization.
This has the added benefit of making it easy to remove the deprecated specialization when we remove (access::)target::local
in the future. 😄
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.
@steffenlarsen Sounds great to me, thanks a lot for the help!
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 have updated this PR to follow the suggested approach. It takes a slightly different structure by using a local_accessor_base
class to implement both local_accessor
and accessor
. This is necessary to handle accessors
template arguments.
Additionally, some changes to Clang's SemaSYCL were applied so the new local_accessor
is identified and correctly handled.
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 look good to me.
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.
e662262
remove unnecessary cl namespace Co-authored-by: Steffen Larsen <[email protected]>
Friendly ping, @intel/dpcpp-esimd-reviewers |
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.
ESIMD related changes have only minor differences in 1 LIT test.
Ok for ESIMD. Thank you.
@AidanBeltonS - Commit fails in post-commit. Seems like MSVC is having trouble with the default template argument in |
Okay I am currently looking into it. |
I have proposed a fix for this issue with #6648. |
This PR fixes an issue caused when building on Windows with MSVC. The problem was introduced in #6341. MSVC does not correctly infer the default template for its return type. This is fixed by setting the return type to auto and letting the compiler infer the return type.
Post-commit is back to green. Thank you, @AidanBeltonS ! |
This PR updates tests that use `target::local` to local_accessor. In all cases the change should not functionally change the test. The goal is to move from the deprecated `target::local` accessor to `local_accessor`. Depends on: intel/llvm#6341
This PR updates tests that use `target::local` to local_accessor. In all cases the change should not functionally change the test. The goal is to move from the deprecated `target::local` accessor to `local_accessor`. Depends on: intel#6341
This PR updates tests that use `target::local` to local_accessor. In all cases the change should not functionally change the test. The goal is to move from the deprecated `target::local` accessor to `local_accessor`. Depends on: intel#6341
This PR creates the
local_accessor
class by aliasing the accessor class withtarget::local
.The motivation behind this is that
target::local
has been deprecated in favour oflocal_accessor
in SYCL2020.The approach of aliasing is taken as the spec states that local_access has the same semantics and restrictions as accessor with target::local.
Related issue: #4713
llvm-test-suite: intel/llvm-test-suite#1063