Esempio n. 1
0
static double dtlane_to_reduction(const std::vector<map_file::DTLane>& dtlanes, int index)
{
	if (is_straight(dtlanes[index]))
		return 1;

	if (is_curve(dtlanes[index])) {
		if (is_crossroad(dtlanes[index]))
			return compute_reduction(dtlanes[index], CROSSROAD_WEIGHT);

		if (is_single_curve(dtlanes, index))
			return 1;

		return compute_reduction(dtlanes[index], CURVE_WEIGHT);
	}

	if (is_clothoid(dtlanes[index]))
		return compute_reduction(dtlanes[index], CLOTHOID_WEIGHT);

	return 1;
}
Esempio n. 2
0
 inline void reduce_1d_local_memory(utils::kernel_generation_stream & stream, std::size_t size, std::vector<std::string> const & bufs, std::vector<scheduler::op_element> const & rops)
 {
     //Reduce local memory
     for(std::size_t stride = size/2 ; stride>0 ; stride /=2){
       stream << "barrier(CLK_LOCAL_MEM_FENCE); " << std::endl;
       stream << "if(lid < " << stride << "){" << std::endl;
       stream.inc_tab();
       for(std::size_t k = 0 ; k < bufs.size() ; ++k){
           std::string acc = bufs[k] + "[lid]";
           std::string str = bufs[k] + "[lid + " + utils::to_string(stride) + "]";
           compute_reduction(stream,acc,str,rops[k]);
       }
       stream.dec_tab();
       stream << "}" << std::endl;
     }
 }