[Openmp-commits] [PATCH] D65340: [OpenMP][libomptarget] Add support for close map modifier

Gheorghe-Teodor Bercea via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 9 12:42:54 PDT 2019


gtbercea marked an inline comment as done.
gtbercea added inline comments.


================
Comment at: libomptarget/test/unified_shared_memory/close_manual.c:46-52
+// For the initalization of the device.
+#pragma omp target map(tofrom : device_alloc)
+  { device_alloc = 10; }
+
+  // CHECK: device_alloc updated on the device
+  if (device_alloc == 10)
+    printf("device_alloc updated on the device\n");
----------------
Hahnfeld wrote:
> gtbercea wrote:
> > Hahnfeld wrote:
> > > gtbercea wrote:
> > > > Hahnfeld wrote:
> > > > > Why do we need this?
> > > > To initialize the device.
> > > This should happen in `__tgt_target_data_begin` which can be a legitimate first directive in a program.
> > Yes target data can be a first directive but if there's no target region in the program then the runtime library won't be loaded/initialized. 
> Ah, got the intention. Can you please add a comment explaining that we need at least one target region to load a "binary" and make all of the data calls work? And I don't think we need to check that `device_alloc` is correctly transferred, do we? There are other tests for that (plus casting `10` to `void *` looks evil anyway).
Of course, I'll add that.
Yeah I'll get rid of the check and the cast! :)


Repository:
  rOMP OpenMP

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65340/new/

https://reviews.llvm.org/D65340





More information about the Openmp-commits mailing list