[PATCH] D36868: [GPGPU] Do not create copy statements when targetting managed memory

Tobias Grosser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 06:12:19 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311157: [GPGPU] Do not create copy statements when targetting managed memory (authored by grosser).

Changed prior to commit:
  https://reviews.llvm.org/D36868?vs=111650&id=111662#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36868

Files:
  polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
  polly/trunk/lib/External/ppcg/gpu.c
  polly/trunk/lib/External/ppcg/gpu.h


Index: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
===================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -3140,7 +3140,8 @@
       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));
     }
 
Index: polly/trunk/lib/External/ppcg/gpu.h
===================================================================
--- polly/trunk/lib/External/ppcg/gpu.h
+++ polly/trunk/lib/External/ppcg/gpu.h
@@ -447,7 +447,8 @@
 __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);
 
Index: polly/trunk/lib/External/ppcg/gpu.c
===================================================================
--- polly/trunk/lib/External/ppcg/gpu.c
+++ polly/trunk/lib/External/ppcg/gpu.c
@@ -5277,7 +5277,7 @@
  * 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 @@
 	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 @@
 			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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36868.111662.patch
Type: text/x-patch
Size: 2751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/6b160dfe/attachment.bin>


More information about the llvm-commits mailing list