[polly] r311157 - [GPGPU] Do not create copy statements when targetting managed memory
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 06:11:06 PDT 2017
Author: grosser
Date: Fri Aug 18 06:11:05 2017
New Revision: 311157
URL: http://llvm.org/viewvc/llvm-project?rev=311157&view=rev
Log:
[GPGPU] Do not create copy statements when targetting managed memory
Summary:
They are not used and consequently do not even need to be computed. This reduces
the overall compile time for our kernel from 1m33s to 17s.
Reviewers: Meinersbur, bollu, singam-sanjay
Reviewed By: bollu
Subscribers: nemanjai, pollydev, llvm-commits, kbarton
Tags: #polly
Differential Revision: https://reviews.llvm.org/D36868
Modified:
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
polly/trunk/lib/External/ppcg/gpu.c
polly/trunk/lib/External/ppcg/gpu.h
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=311157&r1=311156&r2=311157&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Fri Aug 18 06:11:05 2017
@@ -3140,7 +3140,8 @@ public:
DEBUG(dbgs() << getUniqueScopName(S)
<< " does not have permutable bands. Bailing out\n";);
} else {
- Schedule = map_to_device(PPCGGen, Schedule);
+ const bool CreateTransferToFromDevice = !PollyManagedMemory;
+ Schedule = map_to_device(PPCGGen, Schedule, CreateTransferToFromDevice);
PPCGGen->tree = generate_code(PPCGGen, isl_schedule_copy(Schedule));
}
Modified: polly/trunk/lib/External/ppcg/gpu.c
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/ppcg/gpu.c?rev=311157&r1=311156&r2=311157&view=diff
==============================================================================
--- polly/trunk/lib/External/ppcg/gpu.c (original)
+++ polly/trunk/lib/External/ppcg/gpu.c Fri Aug 18 06:11:05 2017
@@ -5277,7 +5277,7 @@ static __isl_give isl_schedule_node *add
* around the entire schedule.
*/
__isl_give isl_schedule *map_to_device(struct gpu_gen *gen,
- __isl_take isl_schedule *schedule)
+ __isl_take isl_schedule *schedule, int to_from_device)
{
isl_schedule_node *node;
isl_set *context;
@@ -5309,7 +5309,12 @@ __isl_give isl_schedule *map_to_device(s
prefix = isl_union_map_preimage_domain_union_pw_multi_aff(prefix,
contraction);
node = mark_kernels(gen, node);
- node = add_to_from_device(node, domain, prefix, gen->prog);
+ if (to_from_device) {
+ node = add_to_from_device(node, domain, prefix, gen->prog);
+ } else {
+ isl_union_set_free(domain);
+ isl_union_map_free(prefix);
+ }
node = isl_schedule_node_root(node);
node = isl_schedule_node_child(node, 0);
node = isl_schedule_node_child(node, 0);
@@ -5675,7 +5680,8 @@ static __isl_give isl_printer *generate(
p = print_cpu(p, scop, options);
isl_schedule_free(schedule);
} else {
- schedule = map_to_device(gen, schedule);
+ const int create_to_from_device = 1;
+ schedule = map_to_device(gen, schedule, create_to_from_device);
gen->tree = generate_code(gen, schedule);
p = ppcg_set_macro_names(p);
p = ppcg_print_exposed_declarations(p, prog->scop);
Modified: polly/trunk/lib/External/ppcg/gpu.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/ppcg/gpu.h?rev=311157&r1=311156&r2=311157&view=diff
==============================================================================
--- polly/trunk/lib/External/ppcg/gpu.h (original)
+++ polly/trunk/lib/External/ppcg/gpu.h Fri Aug 18 06:11:05 2017
@@ -447,7 +447,8 @@ __isl_give isl_schedule_node *gpu_create
__isl_give isl_schedule *get_schedule(struct gpu_gen *gen);
int has_any_permutable_node(__isl_keep isl_schedule *schedule);
__isl_give isl_schedule *map_to_device(struct gpu_gen *gen,
- __isl_take isl_schedule *schedule);
+ __isl_take isl_schedule *schedule,
+ int to_from_device);
__isl_give isl_ast_node *generate_code(struct gpu_gen *gen,
__isl_take isl_schedule *schedule);
More information about the llvm-commits
mailing list