Skip to content
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

[SYCLomatic] Change the pointer_t to element_t to add const qualifier if needed. #2384

Open
wants to merge 4 commits into
base: SYCLomatic
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions clang/runtime/dpct-rt/include/dpct/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,6 @@ template <memory_region Memory, class T = byte_t> class memory_traits {
(Memory == constant) ? sycl::access_mode::read
: sycl::access_mode::read_write;
static constexpr size_t type_size = sizeof(T);
using element_t =
typename std::conditional<Memory == constant, const T, T>::type;
using value_t = typename std::remove_cv<T>::type;
template <size_t Dimension = 1>
using accessor_t = typename std::conditional<
Expand Down Expand Up @@ -1422,7 +1420,6 @@ template <class T, memory_region Memory, size_t Dimension> class accessor;
template <class T, memory_region Memory> class accessor<T, Memory, 3> {
public:
using memory_t = detail::memory_traits<Memory, T>;
using element_t = typename memory_t::element_t;
using pointer_t = typename memory_t::pointer_t;
using accessor_t = typename memory_t::template accessor_t<3>;
accessor(pointer_t data, const sycl::range<3> &in_range)
Expand All @@ -1448,7 +1445,6 @@ template <class T, memory_region Memory> class accessor<T, Memory, 3> {
template <class T, memory_region Memory> class accessor<T, Memory, 2> {
public:
using memory_t = detail::memory_traits<Memory, T>;
using element_t = typename memory_t::element_t;
using pointer_t = typename memory_t::pointer_t;
using accessor_t = typename memory_t::template accessor_t<2>;
accessor(pointer_t data, const sycl::range<2> &in_range)
Expand All @@ -1457,9 +1453,10 @@ template <class T, memory_region Memory> class accessor<T, Memory, 2> {
accessor(typename std::enable_if<M != local, const accessor_t>::type &acc)
: accessor(acc, acc.get_range()) {}
accessor(const accessor_t &acc, const sycl::range<2> &in_range)
: accessor(
acc.template get_multi_ptr<sycl::access::decorated::no>().get(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add deprecated message.

in_range) {}
: accessor(const_cast<pointer_t>(
acc.template get_multi_ptr<sycl::access::decorated::no>()
.get()),
in_range) {}

pointer_t operator[](size_t index) const {
return _data + _range.get(1) * index;
Expand Down
Loading