MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / reverse

Function reverse

include/hipSYCL/algorithms/algorithm.hpp:493–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491
492template <class BidirIt>
493sycl::event reverse(sycl::queue &q, BidirIt first, BidirIt last,
494 const std::vector<sycl::event> &deps = {}) {
495 auto size = std::distance(first, last);
496 if (first == last || size == 1)
497 return sycl::event{};
498
499 return q.parallel_for(sycl::range{size/2}, deps,
500 [=](sycl::id<1> id) {
501 auto offset = size - id[0] - 1;
502 auto input = std::next(first, id[0]);
503 auto output = std::next(first, offset);
504 std::iter_swap(input, output);
505 });
506}
507
508template <class BidirIt, class ForwardIt>
509sycl::event reverse_copy(sycl::queue &q, BidirIt first,

Callers 3

createLoopsAroundFunction · 0.50
test_reverse_copyFunction · 0.50
test_reverseFunction · 0.50

Calls 1

parallel_forMethod · 0.45

Tested by 2

test_reverse_copyFunction · 0.40
test_reverseFunction · 0.40