49 template <
typename ScoringScheme>
53 pipeline.
reads.size(),
54 pipeline.
reads.name_stream(),
55 pipeline.
reads.name_index(),
74 template <
typename BatchType,
typename ContextType> __global__
76 const BatchType read_batch,
78 const ContextType context,
83 volatile uint32& warp_broadcast = sm_broadcast[ warp_id() ];
96 if (context.stop( read_id ))
102 hit_deque_reference hit_deque = hits[ read_id ];
103 if (hit_deque.size() == 0)
116 if (hit_deque.size() == 0)
119 hit =
const_cast<SeedHit*
>( &hit_deque.top() );
138 out_hit.
loc = sa_pos;
144 template <
typename ProbTree>
148 for (
uint32 i = 0; i < 10; ++i)
152 const uint32 ri = 1664525u * rseeds[ read_id ] + 1013904223u;
155 rseeds[ read_id ] = ri;
158 const float rf = float(ri) / float(0xFFFFFFFFu);
168 SeedHit* hit = &hits_data[ hit_id ];
172 if (hit->
empty() ==
false)
181 template <
typename BatchType,
typename ContextType> __global__
183 const BatchType read_batch,
186 const ContextType context,
193 volatile uint32& warp_broadcast = sm_broadcast[ warp_id() ];
206 if (context.stop( read_id ))
212 hit_deque_reference hit_deque = hits[ read_id ];
213 if (hit_deque.size() == 0)
216 ProbTree prob_tree( hit_deque.size(), hit_deque.get_probs() );
217 SeedHit* hits_data( hit_deque.get_data() );
220 if (prob_tree.sum() <= 0.0f)
223 hits.
erase( read_id );
228 if (top_flag && hits_data[0].empty())
234 SeedHit* hit = &hits_data[ hit_id ];
241 hits.
erase( read_id );
251 prob_tree.set( hit_id, 0.0f );
275 out_hit.
loc = sa_pos;
293 template <
typename BatchType,
typename ContextType> __global__
295 const BatchType read_batch,
297 const ContextType context,
312 if (context.stop( read_id ))
318 hit_deque_reference hit_deque = hits[ read_id ];
319 if (hit_deque.size() == 0)
323 typedef typename read_hits_binder::reference hit_reference;
326 read_hits_binder dst_read_hits( scoring_queues );
329 uint32 n_selected_hits = 0u;
332 for (
uint32 i = 0; i < n_multi; ++i)
344 if (hit_deque.size() == 0)
348 hit =
const_cast<SeedHit*
>( &hit_deque.top() );
355 if (output_lane ==
uint32(-1))
358 output_lane = atomicAdd( scoring_queues.
active_reads.out_size, 1u );
362 dst_read_hits.bind( output_lane );
373 dst_read_hits.bind_hit( n_selected_hits, slot );
375 hit_reference out_hit = dst_read_hits[ n_selected_hits ];
376 out_hit.read_id = read_id;
377 out_hit.loc = sa_pos;
393 volatile uint32& warp_broadcast1 = sm_broadcast1[ warp_id() ];
394 volatile uint32& warp_broadcast2 = sm_broadcast2[ warp_id() ];
398 for (
uint32 i = 0; i < n_multi && __any(active); ++i)
406 hit =
const_cast<SeedHit*
>( &hit_deque.top() );
415 if (hit_deque.size() == 0)
424 hit =
const_cast<SeedHit*
>( &hit_deque.top() );
435 if (output_lane ==
uint32(-1))
441 dst_read_hits.bind( output_lane );
454 dst_read_hits.bind_hit( n_selected_hits, slot );
456 hit_reference out_hit = dst_read_hits[ n_selected_hits ];
457 out_hit.read_id = read_id;
458 out_hit.loc = sa_pos;
469 if (output_lane !=
uint32(-1))
472 dst_read_hits.set_read_info(
packed_read( read_id, top_flag ) );
475 dst_read_hits.resize( n_selected_hits );
491 template <
typename BatchType,
typename ContextType> __global__
493 const BatchType read_batch,
496 const ContextType context,
513 if (context.stop( read_id ))
519 hit_deque_reference hit_deque = hits[ read_id ];
520 if (hit_deque.size() == 0)
523 ProbTree prob_tree( hit_deque.size(), hit_deque.get_probs() );
524 SeedHit* hits_data( hit_deque.get_data() );
527 typedef typename read_hits_binder::reference hit_reference;
530 read_hits_binder dst_read_hits( scoring_queues );
533 uint32 n_selected_hits = 0u;
535 for (
uint32 i = 0; i < n_multi; ++i)
538 if (prob_tree.sum() <= 0.0f)
541 hits.
erase( read_id );
546 if (top_flag && hits_data[0].empty())
552 SeedHit* hit = &hits_data[ hit_id ];
559 hits.
erase( read_id );
569 prob_tree.set( hit_id, 0.0f );
571 if (output_lane ==
uint32(-1))
574 output_lane = atomicAdd( scoring_queues.
active_reads.out_size, 1u );
578 dst_read_hits.bind( output_lane );
586 dst_read_hits.bind_hit( n_selected_hits, slot );
588 hit_reference out_hit = dst_read_hits[ n_selected_hits ];
589 out_hit.read_id = read_id;
590 out_hit.loc = sa_pos;
599 if (output_lane !=
uint32(-1))
602 dst_read_hits.set_read_info(
packed_read( read_id, top_flag ) );
605 dst_read_hits.resize( n_selected_hits );
616 template <
typename BatchType,
typename ContextType>
618 const BatchType read_batch,
620 const ContextType context,
626 select_kernel<<<blocks, BLOCKDIM>>>(
637 template <
typename BatchType,
typename ContextType>
639 const BatchType read_batch,
642 const ContextType context,
648 rand_select_kernel<<<blocks, BLOCKDIM>>>(
669 template <
typename BatchType,
typename ContextType>
671 const BatchType read_batch,
673 const ContextType context,
680 select_multi_kernel<<<blocks, BLOCKDIM>>>(
701 template <
typename BatchType,
typename ContextType>
703 const BatchType read_batch,
706 const ContextType context,
713 rand_select_multi_kernel<<<blocks, BLOCKDIM>>>(
725 template <
typename BatchType,
typename ContextType>
727 const BatchType read_batch,
730 const ContextType context,
792 template <
typename ScoringScheme,
typename ContextType>
794 const ContextType context,