[flang-commits] [flang] [flang][cuda] Remove check for obsolete constraint (PR #70707)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Oct 30 11:56:01 PDT 2023
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/70707
The online CUDA Fortran documentation states that a device subprogram must be a top-level module subprogram, but this has turned out to be an obsolete constraint. Stop enforcing it.
>From 70dff54da1df6c825513e1091b590c336371eb7e Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Mon, 30 Oct 2023 11:53:38 -0700
Subject: [PATCH] [flang][cuda] Remove check for obsolete constraint
The online CUDA Fortran documentation states that a device subprogram
must be a top-level module subprogram, but this has turned out to
be an obsolete constraint. Stop enforcing it.
---
flang/lib/Semantics/check-declarations.cpp | 6 ------
flang/test/Semantics/cuf02.cuf | 2 --
2 files changed, 8 deletions(-)
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 2c2866d590ae5a4..32583643dc0f2e9 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -1394,12 +1394,6 @@ void CheckHelper::CheckSubprogram(
if (ClassifyProcedure(symbol) == ProcedureDefinitionClass::Internal) {
messages_.Say(symbol.name(),
"A device subprogram may not be an internal subprogram"_err_en_US);
- } else if ((*cudaAttrs == common::CUDASubprogramAttrs::Device ||
- *cudaAttrs == common::CUDASubprogramAttrs::HostDevice) &&
- (symbol.owner().kind() != Scope::Kind::Module ||
- details.isInterface())) {
- messages_.Say(symbol.name(),
- "An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure"_err_en_US);
}
}
if ((!details.cudaLaunchBounds().empty() ||
diff --git a/flang/test/Semantics/cuf02.cuf b/flang/test/Semantics/cuf02.cuf
index 38b3e783d86b3a4..881a3005e2817bd 100644
--- a/flang/test/Semantics/cuf02.cuf
+++ b/flang/test/Semantics/cuf02.cuf
@@ -1,7 +1,6 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
module m
interface
- !ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure
attributes(device) subroutine exts1
end
end interface
@@ -44,6 +43,5 @@ module m
end
end
-!ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure
attributes(device) subroutine exts1
end
More information about the flang-commits
mailing list