5 #include "cuda_common.h"
7 #include "ppcg_options.h"
10 struct cuda_info cuda
;
11 struct gpucode_info code
;
12 struct gpucode_info kernel_code
;
13 struct gpucode_info stmt_code
;
16 struct ppcg_options
*options
;
19 struct pet_scop
*scop
;
21 /* Set of parameter values */
24 /* Uninitialized data elements (or an overapproximation) */
25 isl_union_set
*copy_in
;
27 /* All read accesses in the entire program */
30 /* All write accesses in the entire program */
33 /* Array of statements */
35 struct cuda_stmt
*stmts
;
38 struct cuda_array_info
*array
;
40 /* Identifier of current kernel. */
43 /* First tile dimension. */
45 /* Number of tile dimensions. */
47 /* Number of initial parallel loops among tile dimensions. */
50 /* Number of dimensions determining shared memory. */
53 /* Number of rows in the untiled schedule. */
55 /* Number of rows in the tiled schedule. */
57 /* Number of rows in schedule after tiling/wrapping over threads. */
60 /* Global untiled schedule. */
62 /* Local (per kernel launch) tiled schedule. */
63 isl_union_map
*tiled_sched
;
64 /* Local schedule per shared memory tile loop iteration. */
65 isl_union_map
*local_sched
;
66 /* Domain of the current statement (within print_statement). */
69 /* Position of first parameter corresponding to shared tile loop
72 unsigned first_shared
;
73 /* Local tiled schedule projected onto the shared tile loops and
74 * the loops that will be wrapped over the threads,
75 * with all shared tile loops parametrized.
77 isl_union_map
*shared_sched
;
78 /* Projects out the loops that will be wrapped over the threads
81 isl_union_map
*shared_proj
;
83 /* A map that takes the range of shared_sched as input,
84 * wraps the appropriate loops over the threads and then projects
87 isl_map
*privatization
;
89 /* A map from the shared memory tile loops and the thread indices
90 * (as parameters) to the set of accessed memory elements that
91 * will be accessed through private copies.
93 isl_union_map
*private_access
;
95 /* The schedule for the current private access
96 * (within print_private_access).
98 isl_map
*private_sched
;
99 /* The array reference group corresponding to private_sched. */
100 struct cuda_array_ref_group
*private_group
;
102 /* First loop to unroll (or -1 if none). */
107 /* Note: in the input file, the sizes of the grid and the blocks
108 * are specified in the order x, y, z, but internally, the sizes
109 * are stored in reverse order, so that the last element always
110 * refers to the x dimension.
117 __isl_give isl_set
*add_context_from_str(__isl_take isl_set
*set
,
119 void collect_array_info(struct cuda_gen
*gen
);
120 void print_host_code(struct cuda_gen
*gen
);
121 void clear_cuda_gen(struct cuda_gen
*gen
);
123 int cuda_pet(isl_ctx
*ctx
, struct pet_scop
*scop
, struct ppcg_options
*options
,