| 884 | |
| 885 | template <class ForwardIt1, class ForwardIt2, class BinaryPredicate> |
| 886 | sycl::event mismatch(sycl::queue &q, util::allocation_group &scratch_allocations, |
| 887 | ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, |
| 888 | ForwardIt2 last2, BinaryPredicate p, |
| 889 | typename std::iterator_traits<ForwardIt1>::difference_type* out, |
| 890 | const std::vector<sycl::event>& deps = {}) { |
| 891 | if (first1 == last1 || first2 == last2) |
| 892 | return sycl::event{}; |
| 893 | |
| 894 | using DiffT = typename std::iterator_traits<ForwardIt1>::difference_type; |
| 895 | DiffT problem_size = std::min(std::distance(first1, last1), |
| 896 | std::distance(first2, last2)); |
| 897 | |
| 898 | auto kernel = [=](sycl::id<1> idx, auto& reducer) { |
| 899 | auto input1 = std::next(first1, idx[0]); |
| 900 | auto input2 = std::next(first2, idx[0]); |
| 901 | if ( p(*input1, *input2) ) |
| 902 | reducer.combine(problem_size); |
| 903 | else |
| 904 | reducer.combine(idx[0]); |
| 905 | }; |
| 906 | |
| 907 | auto reduce = sycl::minimum<DiffT>{}; |
| 908 | |
| 909 | return detail::transform_reduce_impl(q, scratch_allocations, out, |
| 910 | std::numeric_limits<DiffT>::max(), |
| 911 | problem_size, kernel, reduce, deps); |
| 912 | } |
| 913 | |
| 914 | template <class ForwardIt1, class ForwardIt2, class BinaryPredicate> |
| 915 | sycl::event mismatch(sycl::queue &q, util::allocation_group &scratch_allocations, |