-
Notifications
You must be signed in to change notification settings - Fork 738
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
[SYCL] Implement SYCL 2020 multi_ptr #6893
[SYCL] Implement SYCL 2020 multi_ptr #6893
Conversation
This commit adds implementations of SYCL 2020 multi_ptr and address_space_cast. Likewise it adds the legacy decoration for SYCL 1.2.1 style multi_ptr as deprecated. To prevent breaking user code the legacy decoration is made the default. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
e0acfbe
to
86cb94a
Compare
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
getPointerAdjusted would accidentally drop the address space of the qualified pointer, in turn causing an address-space cast when creating a multi_ptr from it. To avoid this, getPointerAdjusted is made auto to pick return type based on getQualifiedPtr rather than always address-space-less. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Co-authored-by: Alexey Sachkov <alexey.sachkov@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.
Nice work which highlighted some spec issues.
You seem to pick by default the decorated interface regardless of whether you need the interface to return decorated pointers or not. I would advice to favour the decorated::no
over decorated::yes
. The reason is decorated::yes
uses types that requires extension to C++ to be built therefore it requires the user to understand this for them to cope with this. The version with decorated::no
doesn't require require any extension from a user perspective (unless they use get_decorated
). While your patch doesn't trigger unintended exposure, it implicitly encourages it.
sycl/include/sycl/group.hpp
Outdated
auto DestP = multi_ptr<VecT, DestS, DestIsDecorated>( | ||
reinterpret_cast<VecT *>(Dest.get())); | ||
auto SrcP = multi_ptr<VecT, SrcS, SrcIsDecorated>( | ||
reinterpret_cast<VecT *>(Src.get())); |
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's not using the spec interface, spec is missing a cast operator ...
spec compliant work around
auto DestP = multi_ptr<VecT, DestS, DestIsDecorated>( | |
reinterpret_cast<VecT *>(Dest.get())); | |
auto SrcP = multi_ptr<VecT, SrcS, SrcIsDecorated>( | |
reinterpret_cast<VecT *>(Src.get())); | |
auto DestP = address_space_cast<VecT, DestS, DestIsDecorated>( | |
reinterpret_cast<VecT *>(Dest.get())); | |
auto SrcP = address_space_cast<VecT, SrcS, SrcIsDecorated>( | |
reinterpret_cast<VecT *>(Src.get())); |
(potentially uses DPC++ extension to strip away address space via the reinterpret cast)
Ideally you would have
auto DestP = multi_ptr<VecT, DestS, DestIsDecorated>( | |
reinterpret_cast<VecT *>(Dest.get())); | |
auto SrcP = multi_ptr<VecT, SrcS, SrcIsDecorated>( | |
reinterpret_cast<VecT *>(Src.get())); | |
auto DestP = address_space_cast<VecT, DestS, DestIsDecorated>( | |
reinterpret_cast<VecT *>(Dest.get_raw())); | |
auto SrcP = address_space_cast<VecT, SrcS, SrcIsDecorated>( | |
reinterpret_cast<VecT *>(Src.get_raw())); |
but we would need to add get_raw
to the legacy interface.
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 made the first changes, i.e. the work-around. Should this be brought to SYCL-Docs?
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.
Changes to extension specifications LGTM.
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
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.
Changes in matrix LGTM
@steffenlarsen, please, resolve merge conflicts. It looks easy to do, but I think I'll mess-up formatting. |
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@intel/llvm-reviewers-runtime | @KseniyaTikhomirova - Friendly ping. |
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
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.
Thanks for the updates :)
/verify with intel/llvm-test-suite#1293 |
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
/verify with intel/llvm-test-suite#1293 |
1 similar comment
/verify with intel/llvm-test-suite#1293 |
intel#6893 added support for SYCL 2020 multi_ptr as well as a fix to one of the operators. The fixed operator did however retain an unused parameter. This commit removes this unused parameter. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
#6893 added support for SYCL 2020 multi_ptr as well as a fix to one of the operators. The fixed operator did however retain an unused parameter. This commit removes this unused parameter. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
This commit adds implementations of SYCL 2020
multi_ptr
andaddress_space_cast
. Likewise it adds thelegacy
decoration for SYCL 1.2.1 stylemulti_ptr
as deprecated.To prevent breaking user code the legacy decoration is made the default.
Test-suite changes: intel/llvm-test-suite#1293