intel / llvm

Intel staging area for llvm.org contribution. Home for Intel LLVM-based projects.
Other
1.22k stars 730 forks source link

Wrong return type for sycl::accessor::get_pointer() and sycl::local_accessor::get_pointer() #8301

Closed aleksmesh closed 1 year ago

aleksmesh commented 1 year ago

Wrong return type for sycl::accessor::get_pointer() and sycl::local_accessor::get_pointer(). According to 4.7.6.9.1. Interface for buffer command accessors and 4.7.6.11.1. Interface for local accessors std::add_pointer_t<value_type> get_pointer() const noexcept; But currently get_pointer return type ismulti_ptr<value_type,...> instead of std::add_pointer_t<value_type>.

To reproduce:

#include <sycl.hpp>

int main () {
  using AccT = sycl::local_accessor<int, 3>;
  sycl::queue queue;
  queue.submit([=](sycl::handler& cgh) {
    AccT acc{};
    auto p = acc.get_pointer();
    static_assert(
          std::is_same_v<decltype(p), std::add_pointer_t<typename AccT::value_type>>);
  });
  return 0;
}

To build: clang++ -fsycl wrong_pointer_type_local_sample.cpp -o sample

Output:

wrong_pointer_type_local_sample.cpp:9:5: error: static assertion failed due to requirement 'std::is_same_v<sycl::multi_ptr<int, sycl::access::address_space::local_space, sycl::access::decorated::legacy>, int *>'
    static_assert(
    ^
1 error generated.
AlexeySachkov commented 1 year ago

Should be fixed by #8493, closing this one