Skip to content

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

Closed
@aleksmesh

Description

@aleksmesh

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 is multi_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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CTSImpacts Khronos SYCL CTSbugSomething isn't workingconfirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions