From 4b193dcd1716559ffdb02c4c8843818b22627b89 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 7 May 2014 17:42:21 +0200 Subject: [PATCH] gpu.c: remove_local_accesses: pass tagged access relation instead of group This will allow us to reuse remove_local_accesses from compute_copy_in_and_out where we will need to remove local accesses from all array groups rather than just a single group. Signed-off-by: Sven Verdoolaege --- gpu.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gpu.c b/gpu.c index fbec8b5..d3f74bf 100644 --- a/gpu.c +++ b/gpu.c @@ -1985,9 +1985,13 @@ static __isl_give isl_union_map *wrapped_reference_to_access( return isl_union_set_unwrap(ref); } -/* Given an access relation "access" from "group", remove those reads - * if ("read" is 1) or writes (if "read" is 0) that are only needed to - * communicate data within the same iteration of "sched". +/* Given an access relation "access" from one or more array reference groups, + * remove those reads if ("read" is 1) or writes (if "read" is 0) + * that are only needed to communicate data within + * the same iteration of "sched". + * "tagged" contains all tagged access relations to all + * the array reference groups accessed by "access" from statement + * instances scheduled by "sched". * * If the access is a read then it is either an element of * @@ -2055,23 +2059,22 @@ static __isl_give isl_union_map *wrapped_reference_to_access( * the live out/in relation. */ static __isl_give isl_union_map *remove_local_accesses( - struct gpu_prog *prog, struct gpu_array_ref_group *group, + struct gpu_prog *prog, __isl_take isl_union_map *tagged, __isl_take isl_union_map *access, __isl_take isl_union_map *sched, int read) { int empty; isl_union_pw_multi_aff *tagger; isl_union_set *domain; - isl_union_map *local, *tagged, *external; + isl_union_map *local, *external; isl_union_set *tag_set; if (isl_union_map_is_empty(access)) { isl_union_map_free(sched); + isl_union_map_free(tagged); return access; } - tagged = group_tagged_access_relation(group); - tagger = isl_union_pw_multi_aff_copy(prog->scop->tagger); domain = isl_union_map_domain(isl_union_map_copy(tagged)); tagger = isl_union_pw_multi_aff_intersect_domain(tagger, domain); @@ -2126,14 +2129,15 @@ static __isl_give isl_union_map *remove_local_accesses_group( __isl_take isl_union_map *access, __isl_keep isl_schedule_node *node, int read) { - isl_union_map *sched; + isl_union_map *sched, *tagged; if (isl_union_map_is_empty(access)) return access; + tagged = group_tagged_access_relation(group); sched = isl_schedule_node_get_prefix_schedule_relation(node); - return remove_local_accesses(kernel->prog, group, access, sched, read); + return remove_local_accesses(kernel->prog, tagged, access, sched, read); } /* This function is called before the AST generator starts traversing -- 2.11.4.GIT