src/backends/cuda/cuda.cpp
// basically, call this after every loop/node gen.  If there's a reduction
// this will emit after innermost node, otherwise it'll emit at the end of top
// level loop
basically, call this after every loop/node gen.  If there's a reduction
this will emit after innermost node, otherwise it'll emit at the end of top
level loop
basically call this after every loop / node gen . If there ' s a reduction this will emit after innermost node otherwise it ' ll emit at the end of top level loop
std::string gen_sync(const LoopTree &lt, const Auxiliary &aux,
                     const CudaAux &cuda_aux, LoopTree::TreeRef ref) {
  std::stringstream ss;
  auto depth = ref > -1 ? lt.node(ref).depth : 0;
  if (cuda_aux.syncs.count(ref)) {
    if (count_threads(lt, cuda_aux, ref) > cuda_aux.threads_per_block) {
      ss << "#error CANNOT COMPILE, too many threads to sync\n";
    }
    ss << indent(depth) << "__syncthreads();\n";
  }
  return ss.str();
}
std :: string gen_sync ( const LoopTree & lt , const Auxiliary & aux , const CudaAux & cuda_aux , LoopTree :: TreeRef ref ) { std :: stringstream ss ; auto depth = ref > -1 ? lt . node ( ref ) . depth : 0 ; if ( cuda_aux . syncs . count ( ref ) ) { if ( count_threads ( lt , cuda_aux , ref ) > cuda_aux . threads_per_block ) { ss << " \n " ; } ss << indent ( depth ) << " \n " ; } return ss . str ( ) ; }
basically, call this after every loop/node gen.
basically call this after every loop / node gen .