gpu_array_ref_group: add note about both private_tile and shared_tile being set
[ppcg.git] / gpu_group.h
blobe50be5115c82648143ecfa3206a8d41467767b17
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.
10 * Note that if both private_tile and shared_tile are set, then shared_tile
11 * is only used inside group_common_shared_memory_tile.
13 struct gpu_array_ref_group {
14 /* The references in this group access this local array. */
15 struct gpu_local_array_info *local_array;
16 /* This is the corresponding array. */
17 struct gpu_array_info *array;
18 /* Position of this group in the list of reference groups of array. */
19 int nr;
21 /* The following fields are use during the construction of the groups.
22 * access is the combined access relation relative to the shared
23 * memory tiling. In particular, the domain of the map corresponds
24 * to the first shared_len dimensions of the computed schedule.
25 * write is set if any access in the group is a write.
26 * exact_write is set if all writes are definite writes.
27 * slice is set if there is at least one access in the group
28 * that refers to more than one element
30 isl_map *access;
31 int write;
32 int exact_write;
33 int slice;
35 /* The shared memory tile, NULL if none. */
36 struct gpu_array_tile *shared_tile;
38 /* The private memory tile, NULL if none. */
39 struct gpu_array_tile *private_tile;
41 /* References in this group; point to elements of a linked list. */
42 int n_ref;
43 struct gpu_stmt_access **refs;
45 /* Last shared memory tile dimension that affects tile of this group. */
46 int last_shared;
49 int gpu_group_references(struct gpu_gen *gen);
51 __isl_give isl_printer *gpu_array_ref_group_print_name(
52 struct gpu_array_ref_group *group, __isl_take isl_printer *p);
53 void gpu_array_ref_group_compute_tiling(struct gpu_array_ref_group *group);
54 __isl_give isl_union_map *gpu_array_ref_group_access_relation(
55 struct gpu_array_ref_group *group, int read, int write);
56 int gpu_array_ref_group_requires_unroll(struct gpu_array_ref_group *group);
57 struct gpu_array_tile *gpu_array_ref_group_tile(
58 struct gpu_array_ref_group *group);
59 struct gpu_array_ref_group *gpu_array_ref_group_free(
60 struct gpu_array_ref_group *group);
62 #endif