Skip to content

[flang][cuda] Remove meaningless warning on CUDA shared arguments #152404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flang/include/flang/Support/Fortran.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ static constexpr IgnoreTKRSet ignoreTKRAll{IgnoreTKR::Type, IgnoreTKR::Kind,
std::string AsFortran(IgnoreTKRSet);

bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr>,
std::optional<CUDADataAttr>, IgnoreTKRSet, std::optional<std::string> *,
bool allowUnifiedMatchingRule, bool isHostDeviceProcedure,
std::optional<CUDADataAttr>, IgnoreTKRSet, bool allowUnifiedMatchingRule,
bool isHostDeviceProcedure,
const LanguageFeatureControl *features = nullptr);

static constexpr char blankCommonObjectName[] = "__BLNK__";
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Evaluate/characteristics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ bool DummyDataObject::IsCompatibleWith(const DummyDataObject &actual,
}
if (!attrs.test(Attr::Value) &&
!common::AreCompatibleCUDADataAttrs(cudaDataAttr, actual.cudaDataAttr,
ignoreTKR, warning,
ignoreTKR,
/*allowUnifiedMatchingRule=*/false,
/*=isHostDeviceProcedure*/ false)) {
if (whyNot) {
Expand Down Expand Up @@ -1816,7 +1816,7 @@ bool DistinguishUtils::Distinguishable(
x.intent != common::Intent::In) {
return true;
} else if (!common::AreCompatibleCUDADataAttrs(x.cudaDataAttr, y.cudaDataAttr,
x.ignoreTKR | y.ignoreTKR, nullptr,
x.ignoreTKR | y.ignoreTKR,
/*allowUnifiedMatchingRule=*/false,
/*=isHostDeviceProcedure*/ false)) {
return true;
Expand Down
7 changes: 1 addition & 6 deletions flang/lib/Semantics/check-call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,12 +1058,11 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
dummyName);
}
}
std::optional<std::string> warning;
bool isHostDeviceProc{procedure.cudaSubprogramAttrs &&
*procedure.cudaSubprogramAttrs ==
common::CUDASubprogramAttrs::HostDevice};
if (!common::AreCompatibleCUDADataAttrs(dummyDataAttr, actualDataAttr,
dummy.ignoreTKR, &warning, /*allowUnifiedMatchingRule=*/true,
dummy.ignoreTKR, /*allowUnifiedMatchingRule=*/true,
isHostDeviceProc, &context.languageFeatures())) {
auto toStr{[](std::optional<common::CUDADataAttr> x) {
return x ? "ATTRIBUTES("s +
Expand All @@ -1074,10 +1073,6 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
"%s has %s but its associated actual argument has %s"_err_en_US,
dummyName, toStr(dummyDataAttr), toStr(actualDataAttr));
}
if (warning && context.ShouldWarn(common::UsageWarning::CUDAUsage)) {
messages.Say(common::UsageWarning::CUDAUsage, "%s"_warn_en_US,
std::move(*warning));
}
}

// Warning for breaking F'2023 change with character allocatables
Expand Down
7 changes: 2 additions & 5 deletions flang/lib/Support/Fortran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ std::string AsFortran(IgnoreTKRSet tkr) {
/// dummy argument attribute while `y` represents the actual argument attribute.
bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
std::optional<CUDADataAttr> y, IgnoreTKRSet ignoreTKR,
std::optional<std::string> *warning, bool allowUnifiedMatchingRule,
bool isHostDeviceProcedure, const LanguageFeatureControl *features) {
bool allowUnifiedMatchingRule, bool isHostDeviceProcedure,
const LanguageFeatureControl *features) {
bool isCudaManaged{features
? features->IsEnabled(common::LanguageFeature::CudaManaged)
: false};
Expand Down Expand Up @@ -145,9 +145,6 @@ bool AreCompatibleCUDADataAttrs(std::optional<CUDADataAttr> x,
*y == CUDADataAttr::Shared ||
*y == CUDADataAttr::Constant)) ||
(!y && (isCudaUnified || isCudaManaged))) {
if (y && *y == CUDADataAttr::Shared && warning) {
*warning = "SHARED attribute ignored"s;
}
return true;
}
} else if (*x == CUDADataAttr::Managed) {
Expand Down
18 changes: 0 additions & 18 deletions flang/test/Semantics/cuf17.cuf

This file was deleted.