llvm icon indicating copy to clipboard operation
llvm copied to clipboard

begin, end, cbegin and cend operations are not available for accessors

Open benjamind2330 opened this issue 3 years ago • 1 comments

Per the sycl 2020 standard: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:accessor.common.members

there should be normal iterator access to buffers through the accessor. This is particularly useful for host_accessor. As per the implementation here: https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/accessor.hpp

I cannot find any reference to the begin and end operations.

Simple example code:

  sycl::buffer<sycl::id<3>, 1> ranges{3 * 3 * 3};
    auto h_ranges = ranges.get_host_access();
    auto it       = h_ranges.begin();

Fails to compile with:

error: no member named 'begin' in 'sycl::host_accessor<sycl::id<3>, 1, sycl::access::mode::read_write>'
    auto it       = h_ranges.begin();
                    ~~~~~~~~ ^

DPCPP version is:

dpcpp -v
Intel(R) oneAPI DPC++/C++ Compiler 2022.1.0 (2022.1.0.20220316)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/intel/oneapi/compiler/2022.1.0/linux/bin-llvm

benjamind2330 avatar Sep 15 '22 00:09 benjamind2330

Hi @benjamind2330. This work is in progress https://github.com/intel/llvm/pull/6815

KornevNikita avatar Sep 20 '22 12:09 KornevNikita

All accessor iterator methods are implemented.

KornevNikita avatar May 09 '23 09:05 KornevNikita