Skip to content

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

@benjamind2330

Description

@benjamind2330

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions