-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Fix return type of the accessor::get_pointer and local_accessor::get_pointer. #8493
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
Update failing tests due to adding diagnostic for const qualified DataT only allowed for non readonly accessor.
- Use -Xclang -verify for testing
Having it requires handling over 20 expected-erros.
…o inheritance from base class hitting assert.
sycl/include/sycl/multi_ptr.hpp
Outdated
@@ -1148,6 +1154,9 @@ class multi_ptr<const void, Space, access::decorated::legacy> { | |||
|
|||
static constexpr access::address_space address_space = Space; | |||
|
|||
using decorated_type = | |||
typename detail::DecoratedType<const void, Space>::type; | |||
|
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.
This should be removed. It is defined publicly, but is not part of the specification.
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 , thanks, done.
sycl/include/sycl/multi_ptr.hpp
Outdated
@@ -1006,6 +1009,9 @@ class multi_ptr<void, Space, access::decorated::legacy> { | |||
|
|||
static constexpr access::address_space address_space = Space; | |||
|
|||
using decorated_type = | |||
typename detail::DecoratedType<const void, Space>::type; |
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.
Same applies to this. The places in this class that uses it should be able to use pointer_t
instead.
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 , thanks, done.
Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
access::placeholder::true_t>; | ||
using local_accessor_t = local_accessor<int, size>; | ||
|
||
auto ptr = buffer.get_access<access_mode::read_write, target::device>(cgh); | ||
auto ptr = buffer.get_host_access(cgh); |
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 am not sure I understand this change. ptr
would be a host_accessor
. Why do we compare its get_multi_ptr
result to a host_task
accessor's accessor_t
?
Also, if you would like to check the type of the access::target::host_task
it would be best to add it here rather than replace the one for access::target::device
, just to avoid reducing our test coverage.
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 @steffenlarsen, I reverted those changes and added a new test for get_pointer.
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.
Tiny nit, otherwise LGTM!
static_assert(std::is_same_v<decltype(target_local_ptr), local_ptr<int>>); | ||
static_assert( | ||
std::is_same_v<decltype(local_pointer), std::add_pointer_t<int>>); | ||
} |
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.
} | |
} | |
/verify with intel/llvm-test-suite#1670 |
hi, @mmoadeli, as this is a change that breaking backward compatibility, kernel code using local_accssor will not be backward compatible, do you have any idea/advice for this issue? |
Hi @Wanzizhu ! The |
hi, @steffenlarsen , i tried
|
@Wanzizhu Accessor specialization with target::local have below signature while Depending on which you use, you may need to update your code accordingly. |
@Wanzizhu - The T *lmem = sycl::local_ptr<T>(scratch_.get_pointer()).get(); This is slightly less performant than T *lmem = scratch_.get_pointer(); If you wanted to use the more performant paths, you could have a function like: // Getting a multi_ptr from a local_accessor.
template <typename T, int Dims> sycl::local_ptr<T> getMultiPtr(sycl::local_accessor<T, Dims> &LAcc) {
if constexpr (std::is_same_v<decltype(LAcc.get_pointer()), sycl::local_ptr<T>>)
return LAcc.get_pointer();
else
return LAcc.get_multi_ptr<sycl::access::decorated::legacy>();
}
// Getting a raw pointer from a local_accessor
template <typename T, int Dims> T *getPtr(sycl::local_accessor<T, Dims> &LAcc) {
if constexpr (std::is_same_v<decltype(LAcc.get_pointer()), sycl::local_ptr<T>>)
return LAcc.get_pointer().get();
else
return LAcc.get_pointer();
} |
thanks, i wil take this solution. |
std::add_pointer_t<value_type>