From ad6c34b8c266b54fc7206bbd41d872ae49c2d4fb Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 3 Oct 2013 15:40:50 +0200 Subject: [PATCH] gpu_group.c: set_last_shared: extract out gpu_array_ref_group_tile This function returns the (private or shared) array tile associated to a group (if any) and will be useful for any code that does not care whether the tile is for private or shared memory. Signed-off-by: Sven Verdoolaege --- gpu_group.c | 19 ++++++++++++++++--- gpu_group.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gpu_group.c b/gpu_group.c index e51c7f4..ad830fb 100644 --- a/gpu_group.c +++ b/gpu_group.c @@ -50,6 +50,21 @@ __isl_give isl_union_map *gpu_array_ref_group_access_relation( return access; } +/* Return the effective gpu_array_tile associated to "group" or + * NULL if there is no such gpu_array_tile. + * If we have computed both a private and a shared tile, then + * the private tile is used. + */ +struct gpu_array_tile *gpu_array_ref_group_tile( + struct gpu_array_ref_group *group) +{ + if (group->private_tile) + return group->private_tile; + if (group->shared_tile) + return group->shared_tile; + return NULL; +} + /* Given a constraint * * a(p,i) + j = g f(e) @@ -505,9 +520,7 @@ static void set_last_shared(struct gpu_gen *gen, group->last_shared = gen->shared_len - 1; - tile = group->private_tile; - if (!tile) - tile = group->shared_tile; + tile = gpu_array_ref_group_tile(group); if (!tile) return; diff --git a/gpu_group.h b/gpu_group.h index 008f9f9..a6d360e 100644 --- a/gpu_group.h +++ b/gpu_group.h @@ -51,6 +51,8 @@ __isl_give isl_printer *gpu_array_ref_group_print_name( void gpu_array_ref_group_compute_tiling(struct gpu_array_ref_group *group); __isl_give isl_union_map *gpu_array_ref_group_access_relation( struct gpu_array_ref_group *group, int read, int write); +struct gpu_array_tile *gpu_array_ref_group_tile( + struct gpu_array_ref_group *group); struct gpu_array_ref_group *gpu_array_ref_group_free( struct gpu_array_ref_group *group); -- 2.11.4.GIT