[PATCH] D36867: [GPGPU] Synchronize after each kernel, not each copy out

Tobias Grosser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 03:49:52 PDT 2017


grosser created this revision.
grosser added a project: Polly.
Herald added subscribers: kbarton, nemanjai.

This change reduces the overall number of synchronize calls for kernels with
a lot of output data at the cost of additional synchronize calls for kernels
launched in sequence without any device to host transfers in between. As the
latter pattern is a lot less frequent, this seems a better tradeoff.

Even though the above motivation would be motivation enough, this is just
a step towards enabling ppcg to not compute to and from device copy calls
at all, which would be incorrect in case we still relied on these calls to
place our synchronization statements.


https://reviews.llvm.org/D36867

Files:
  lib/CodeGen/PPCGCodeGeneration.cpp


Index: lib/CodeGen/PPCGCodeGeneration.cpp
===================================================================
--- lib/CodeGen/PPCGCodeGeneration.cpp
+++ lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1219,6 +1219,8 @@
   const char *Str = isl_id_get_name(Id);
   if (!strcmp(Str, "kernel")) {
     createKernel(UserStmt);
+    if (PollyManagedMemory)
+      createCallSynchronizeDevice();
     isl_ast_expr_free(Expr);
     return;
   }
@@ -1248,7 +1250,6 @@
     if (!PollyManagedMemory) {
       createDataTransfer(UserStmt, DEVICE_TO_HOST);
     } else {
-      createCallSynchronizeDevice();
       isl_ast_node_free(UserStmt);
     }
     isl_ast_expr_free(Expr);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36867.111649.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/172886f4/attachment.bin>


More information about the llvm-commits mailing list