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

Jan Patrick Lehr via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 20 00:41:32 PST 2023


================
@@ -3065,6 +3067,21 @@ struct AMDGPUPluginTy final : public GenericPluginTy {
     return KernelAgents;
   }
 
+  /// Returns true if auto zero-copy the best configuration for the current arch
+  /// and binary.
+  bool useAutoZeroCopy() override final {
+    // Automatic zero-copy only applies to programs that did
+    // not request unified_shared_memory and are deployed on an
+    // APU with XNACK enabled.
+    if (getRequiresFlags() & OMP_REQ_UNIFIED_SHARED_MEMORY)
+      return false;
+
+    // XNACK can be enabled with with kernel boot parameter or with
+    // environment variable.
+    return (IsAPU &&
+            (utils::IsXnackEnabledViaKernelParam() || OMPX_HSAXnack.get()));
----------------
jplehr wrote:

No need for `.get()` call here, `BoolEnvar` is convertible to bool.

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


More information about the Openmp-commits mailing list