15 fprintf(
stream,
"rocprim__warp_shuffle_down(val,%d)",offset);
17 fprintf(
stream,
"__shfl_down_sync(AC_INTERNAL_active_threads,val,%d)",offset);
24 char shuffle_down[1000];
25 memset(shuffle_down,0,
sizeof(shuffle_down));
27 FILE* instruction_stream = fmemopen(shuffle_down,
sizeof(shuffle_down),
"w");
29 fclose(instruction_stream);
32 memset(guard,0,
sizeof(guard));
34 FILE* guard_stream = fmemopen(guard,
sizeof(guard),
"w");
35 fprintf(guard_stream,
"if(AC_INTERNAL_active_threads >> (lane_id + %d))",offset);
39 "%s shuffle_tmp = %s;"
43 ,check_activeness ? guard :
""
52 for(
int offset = warp_size/4; offset >= 1; offset /= 2)
60 op ==
REDUCE_MIN ?
"val = val > shuffle_tmp ? shuffle_tmp : val" :
61 op ==
REDUCE_MAX ?
"val = val > shuffle_tmp ? val : shuffle_tmp" :
static const Stream stream
Definition astaroth_device.h:187
ReduceOp
Definition vecs.h:8
@ REDUCE_MAX
Definition vecs.h:11
@ REDUCE_SUM
Definition vecs.h:12
@ REDUCE_MIN
Definition vecs.h:10
const char * get_op_instruction(const ReduceOp op)
Definition warp_reduce.h:56
const char * shuffle_instruction
Definition warp_reduce.h:8
void print_shuffle_down(FILE *stream, const int offset)
Definition warp_reduce.h:12
void print_warp_reduction(FILE *stream, const int warp_size, const char *op_instruction, const bool check_activeness)
Definition warp_reduce.h:49
const char * reduce_op_to_name(const ReduceOp op)
Definition warp_reduce.h:65
void print_shuffle_iteration(FILE *stream, const char *tmp_type, const int offset, const char *op_instruction, const bool check_activeness)
Definition warp_reduce.h:22