[flang-commits] [flang] [flang][cuda] Extends matching distance computation (PR #91810)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Fri May 10 14:12:16 PDT 2024


================
@@ -2546,15 +2557,33 @@ static int GetMatchingDistance(const characteristics::DummyArgument &dummy,
       return 2;
     }
   } else if (*dummyDataAttr == common::CUDADataAttr::Managed) {
-    if (!actualDataAttr || *actualDataAttr == common::CUDADataAttr::Device) {
+    if (!actualDataAttr) {
+      if (isGpuUnified) {
+        return 1;
+      }
+      if (isGpuManaged) {
+        return 0;
+      }
+      return cudaInfMatchingValue;
+    }
+    if (*actualDataAttr == common::CUDADataAttr::Device) {
       return cudaInfMatchingValue;
     } else if (*actualDataAttr == common::CUDADataAttr::Managed) {
       return 0;
     } else if (*actualDataAttr == common::CUDADataAttr::Unified) {
       return 1;
     }
   } else if (*dummyDataAttr == common::CUDADataAttr::Unified) {
-    if (!actualDataAttr || *actualDataAttr == common::CUDADataAttr::Device) {
+    if (!actualDataAttr) {
+      if (isGpuUnified) {
----------------
klausler wrote:

same here

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


More information about the flang-commits mailing list