[Openmp-commits] [openmp] [OpenMP][libomptarget] Enable automatic unified shared memory executi… (PR #75999)

Johannes Doerfert via Openmp-commits openmp-commits at lists.llvm.org
Thu Dec 21 15:49:10 PST 2023


================
@@ -144,19 +144,33 @@ void PluginAdaptorTy::initDevices(PluginManager &PM) {
 
   int32_t NumPD = getNumberOfPluginDevices();
   ExclusiveDevicesAccessor->reserve(DeviceOffset + NumPD);
+  // Auto zero-copy is a per-device property. We need to ensure
+  // that all devices are suggesting to use it.
+  bool UseAutoZeroCopy = true;
+  if (NumPD == 0)
+    UseAutoZeroCopy = false;
   for (int32_t PDevI = 0, UserDevId = DeviceOffset; PDevI < NumPD; PDevI++) {
     auto Device = std::make_unique<DeviceTy>(this, UserDevId, PDevI);
+
     if (auto Err = Device->init()) {
       DP("Skip plugin known device %d: %s\n", PDevI,
          toString(std::move(Err)).c_str());
       continue;
     }
+    UseAutoZeroCopy = Device->useAutoZeroCopy() && UseAutoZeroCopy;
----------------
jdoerfert wrote:

The other way around to save calls into the plugin.

https://github.com/llvm/llvm-project/pull/75999


More information about the Openmp-commits mailing list