Skip to content

[SYCL] Implement span support for sycl::reduction #5941

Closed
@jasonsewall-intel

Description

@jasonsewall-intel

SYCL 2020 rev. 4 specifies that SYCL should accept span for array reductions here, but it isn't currently supported.

For example, I think the following code should work:

int *histogram = sycl::malloc_shared<int>(16,q);
q.submit([&](sycl::handler &h) {
  h.parallel_for(sycl::range<1>(N),
                 sycl::reduction(sycl::span<int>(histogram,16), std::plus<>()),
                 [=](sycl::id<1> i, auto &histo) {
                         histo[i%16] += 1;
                 });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions