#pragma once
#include "launch.hpp"
namespace tf {
namespace detail {
// Function: scan_loop
template
void scan_loop(
tf::Runtime& rt,
std::atomic& counter,
BufferT& buf,
B bop,
Iterator d_beg,
size_t W,
size_t w,
size_t chunk_size
){
// whoever finishes the last performs global scan
if(counter.fetch_add(1, std::memory_order_acq_rel) == W-1) {
for(size_t i=1; i;
using value_type = typename std::iterator_traits::value_type;
return [=] (Runtime& rt) mutable {
// fetch the stateful values
B_t s_beg = first;
E_t s_end = last;
D_t d_beg = d_first;
if(s_beg == s_end) {
return;
}
size_t W = rt.executor().num_workers();
size_t N = std::distance(s_beg, s_end);
// only myself - no need to spawn another graph
if(W ;
using value_type = typename std::iterator_traits::value_type;
return [=] (Runtime& rt) mutable {
// fetch the stateful values
B_t s_beg = first;
E_t s_end = last;
D_t d_beg = d_first;
if(s_beg == s_end) {
return;
}
size_t W = rt.executor().num_workers();
size_t N = std::distance(s_beg, s_end);
// only myself - no need to spawn another graph
if(W