[flang-commits] [flang] Revert "[flang][cuda] Update attribute compatibily check for unified matching rule" (PR #90696)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Tue Apr 30 20:05:05 PDT 2024
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/90696
Reverts llvm/llvm-project#90679
>From 1d433cb330f33ed6f300342ea18c7852c37b81d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?=
=?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?=
=?UTF-8?q?=E3=83=B3=29?= <clementval at gmail.com>
Date: Tue, 30 Apr 2024 20:04:54 -0700
Subject: [PATCH] =?UTF-8?q?Revert=20"[flang][cuda]=20Update=20attribute=20?=
=?UTF-8?q?compatibily=20check=20for=20unified=20matching=E2=80=A6"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 86e5d6f1d83279557170c0b8e8a6a1ec6e4414d2.
---
flang/include/flang/Common/Fortran.h | 4 ++--
flang/lib/Common/Fortran.cpp | 24 +-----------------------
flang/lib/Evaluate/characteristics.cpp | 10 ++++------
flang/lib/Semantics/check-call.cpp | 5 ++---
flang/test/Semantics/cuf13.cuf | 9 ---------
5 files changed, 9 insertions(+), 43 deletions(-)
diff --git a/flang/include/flang/Common/Fortran.h b/flang/include/flang/Common/Fortran.h
index 3b965fe60c2f02..2a53452a2774ff 100644
--- a/flang/include/flang/Common/Fortran.h
+++ b/flang/include/flang/Common/Fortran.h
@@ -114,8 +114,8 @@ static constexpr IgnoreTKRSet ignoreTKRAll{IgnoreTKR::Type, IgnoreTKR::Kind,
IgnoreTKR::Rank, IgnoreTKR::Device, IgnoreTKR::Managed};
std::string AsFortran(IgnoreTKRSet);
-bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr>,
- std::optional<CUDADataAttr>, IgnoreTKRSet, bool allowUnifiedMatchingRule);
+bool AreCompatibleCUDADataAttrs(
+ std::optional<CUDADataAttr>, std::optional<CUDADataAttr>, IgnoreTKRSet);
static constexpr char blankCommonObjectName[] = "__BLNK__";
diff --git a/flang/lib/Common/Fortran.cpp b/flang/lib/Common/Fortran.cpp
index c8efe0bb234328..8ada8fe210a30f 100644
--- a/flang/lib/Common/Fortran.cpp
+++ b/flang/lib/Common/Fortran.cpp
@@ -97,12 +97,8 @@ std::string AsFortran(IgnoreTKRSet tkr) {
return result;
}
-/// Check compatibilty of CUDA attribute.
-/// When `allowUnifiedMatchingRule` is enabled, argument `x` represents the
-/// dummy argument attribute while `y` represents the actual argument attribute.
bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
- std::optional<CUDADataAttr> y, IgnoreTKRSet ignoreTKR,
- bool allowUnifiedMatchingRule) {
+ std::optional<CUDADataAttr> y, IgnoreTKRSet ignoreTKR) {
if (!x && !y) {
return true;
} else if (x && y && *x == *y) {
@@ -118,24 +114,6 @@ bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
x.value_or(CUDADataAttr::Managed) == CUDADataAttr::Managed &&
y.value_or(CUDADataAttr::Managed) == CUDADataAttr::Managed) {
return true;
- } else if (allowUnifiedMatchingRule) {
- if (!x) { // Dummy argument has no attribute -> host
- if (y && *y == CUDADataAttr::Managed || *y == CUDADataAttr::Unified) {
- return true;
- }
- } else {
- if (*x == CUDADataAttr::Device && y &&
- (*y == CUDADataAttr::Managed || *y == CUDADataAttr::Unified)) {
- return true;
- } else if (*x == CUDADataAttr::Managed && y &&
- *y == CUDADataAttr::Unified) {
- return true;
- } else if (*x == CUDADataAttr::Unified && y &&
- *y == CUDADataAttr::Managed) {
- return true;
- }
- }
- return false;
} else {
return false;
}
diff --git a/flang/lib/Evaluate/characteristics.cpp b/flang/lib/Evaluate/characteristics.cpp
index ab03ca5ed2d5a2..20f7476425ace6 100644
--- a/flang/lib/Evaluate/characteristics.cpp
+++ b/flang/lib/Evaluate/characteristics.cpp
@@ -362,9 +362,8 @@ bool DummyDataObject::IsCompatibleWith(const DummyDataObject &actual,
}
}
if (!attrs.test(Attr::Value) &&
- !common::AreCompatibleCUDADataAttrs(cudaDataAttr, actual.cudaDataAttr,
- ignoreTKR,
- /*allowUnifiedMatchingRule=*/false)) {
+ !common::AreCompatibleCUDADataAttrs(
+ cudaDataAttr, actual.cudaDataAttr, ignoreTKR)) {
if (whyNot) {
*whyNot = "incompatible CUDA data attributes";
}
@@ -1755,9 +1754,8 @@ bool DistinguishUtils::Distinguishable(
} else if (y.attrs.test(Attr::Allocatable) && x.attrs.test(Attr::Pointer) &&
x.intent != common::Intent::In) {
return true;
- } else if (!common::AreCompatibleCUDADataAttrs(x.cudaDataAttr, y.cudaDataAttr,
- x.ignoreTKR | y.ignoreTKR,
- /*allowUnifiedMatchingRule=*/false)) {
+ } else if (!common::AreCompatibleCUDADataAttrs(
+ x.cudaDataAttr, y.cudaDataAttr, x.ignoreTKR | y.ignoreTKR)) {
return true;
} else if (features_.IsEnabled(
common::LanguageFeature::DistinguishableSpecifics) &&
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index f0da779785142a..db0949e905a658 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -897,9 +897,8 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
actualDataAttr = common::CUDADataAttr::Device;
}
}
- if (!common::AreCompatibleCUDADataAttrs(dummyDataAttr, actualDataAttr,
- dummy.ignoreTKR,
- /*allowUnifiedMatchingRule=*/true)) {
+ if (!common::AreCompatibleCUDADataAttrs(
+ dummyDataAttr, actualDataAttr, dummy.ignoreTKR)) {
auto toStr{[](std::optional<common::CUDADataAttr> x) {
return x ? "ATTRIBUTES("s +
parser::ToUpperCaseLetters(common::EnumToString(*x)) + ")"s
diff --git a/flang/test/Semantics/cuf13.cuf b/flang/test/Semantics/cuf13.cuf
index 6db829002fae67..7c6673e21bf11b 100644
--- a/flang/test/Semantics/cuf13.cuf
+++ b/flang/test/Semantics/cuf13.cuf
@@ -6,10 +6,6 @@ module matching
module procedure sub_device
end interface
- interface subman
- module procedure sub_host
- end interface
-
contains
subroutine sub_host(a)
integer :: a(:)
@@ -25,13 +21,8 @@ program m
use matching
integer, pinned, allocatable :: a(:)
- integer, managed, allocatable :: b(:)
logical :: plog
allocate(a(100), pinned = plog)
- allocate(b(200))
call sub(a)
-
- call subman(b)
-
end
More information about the flang-commits
mailing list