mirror of
https://github.com/intel/llvm.git
synced 2026-01-22 23:49:22 +08:00
Revert "[flang][cuda] Update attribute compatibily check for unified matching rule" (#90696)
Reverts llvm/llvm-project#90679
This commit is contained in:
committed by
GitHub
parent
8e9b1e9aa8
commit
306ae14fac
@@ -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__";
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user