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

Function find

include/hipSYCL/algorithms/algorithm.hpp:527–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525
526template <class ForwardIt, class T>
527sycl::event find(sycl::queue &q, util::allocation_group &scratch_allocations,
528 ForwardIt first, ForwardIt last, const T &value,
529 typename std::iterator_traits<ForwardIt>::difference_type *out,
530 const std::vector<sycl::event> &deps = {}) {
531 if(first == last)
532 return sycl::event{};
533
534 using DiffT = typename std::iterator_traits<ForwardIt>::difference_type;
535 DiffT problem_size = std::distance(first, last);
536
537 auto transform = [first, value, problem_size] (ForwardIt input) {
538 return (*input == value ? std::distance(first, input) : problem_size);
539 };
540
541 auto kernel = [=](sycl::id<1> idx, auto& reducer) {
542 auto input = first;
543 std::advance(input, idx[0]);
544 reducer.combine(transform(input));
545 };
546
547 auto reduce = sycl::minimum<DiffT>{};
548
549 return detail::transform_reduce_impl(q, scratch_allocations, out,
550 std::numeric_limits<DiffT>::max(),
551 problem_size, kernel, reduce, deps);
552}
553
554template <class ForwardIt, class UnaryPredicate>
555sycl::event find_if(sycl::queue &q, util::allocation_group &scratch_allocations,

Callers 15

SubCFGMethod · 0.50
loadMultiSubCfgValuesMethod · 0.50
fixSingleSubCfgValuesMethod · 0.50
ExpandAggregateArgumentsFunction · 0.50
contains_nodeMethod · 0.50
submitFunction · 0.50
containsMethod · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50
test_findFunction · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50

Calls 4

transform_reduce_implFunction · 0.85
maxClass · 0.85
combineMethod · 0.80
transformFunction · 0.70

Tested by 1

test_findFunction · 0.40