gpu: insert kernel context in schedule tree
[ppcg.git] / gpu_group.h
blob008f9f91b8afdef33fe99b2c6a86e009e50302a1
1 #ifndef GPU_GROUP_H
2 #define GPU_GROUP_H
4 #include "gpu.h"
6 /* A group of array references in a kernel that should be handled together.
7 * If private_tile is not NULL, then it is mapped to registers.
8 * Otherwise, if shared_tile is not NULL, it is mapped to shared memory.
9 * Otherwise, it is accessed from global memory.
11 struct gpu_array_ref_group {
12 /* The references in this group access this local array. */
13 struct gpu_local_array_info *local_array;
14 /* This is the corresponding array. */
15 struct gpu_array_info *array;
16 /* Position of this group in the list of reference groups of array. */
17 int nr;
19 /* The following fields are use during the construction of the groups.
20 * access is the combined access relation relative to the shared
21 * memory tiling. In particular, the domain of the map corresponds
22 * to the first shared_len dimensions of the computed schedule.
23 * write is set if any access in the group is a write.
24 * exact_write is set if all writes are definite writes.
25 * slice is set if there is at least one access in the group
26 * that refers to more than one element
28 isl_map *access;
29 int write;
30 int exact_write;
31 int slice;
33 /* The shared memory tile, NULL if none. */
34 struct gpu_array_tile *shared_tile;
36 /* The private memory tile, NULL if none. */
37 struct gpu_array_tile *private_tile;
39 /* References in this group; point to elements of a linked list. */
40 int n_ref;
41 struct gpu_stmt_access **refs;
43 /* Last shared memory tile dimension that affects tile of this group. */
44 int last_shared;
47 int gpu_group_references(struct gpu_gen *gen);
49 __isl_give isl_printer *gpu_array_ref_group_print_name(
50 struct gpu_array_ref_group *group, __isl_take isl_printer *p);
51 void gpu_array_ref_group_compute_tiling(struct gpu_array_ref_group *group);
52 __isl_give isl_union_map *gpu_array_ref_group_access_relation(
53 struct gpu_array_ref_group *group, int read, int write);
54 struct gpu_array_ref_group *gpu_array_ref_group_free(
55 struct gpu_array_ref_group *group);
57 #endif