[flang-commits] [flang] [flang][cuda] Allow STOP in device context (PR #120625)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Thu Dec 19 11:41:24 PST 2024
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/120625 at github.com>
https://github.com/clementval updated https://github.com/llvm/llvm-project/pull/120625
>From 6a458654368cef9d4f6577ae69bd2c3127754a12 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Thu, 19 Dec 2024 11:39:40 -0800
Subject: [PATCH 1/2] [flang][cuda] Allow STOP in device context
---
flang/lib/Semantics/check-cuda.cpp | 7 +++++++
flang/test/Semantics/cuf09.cuf | 5 +++++
2 files changed, 12 insertions(+)
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index bec3969c7a26b7..ba519a4f37d308 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -82,6 +82,10 @@ struct DeviceExprChecker
}
}
}
+ // c_devloc is inlined in lowering.
+ if (x.GetName().compare("c_devloc") == 0) {
+ return {};
+ }
} else if (x.GetSpecificIntrinsic()) {
// TODO(CUDA): Check for unsupported intrinsics here
return {};
@@ -350,6 +354,9 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
void Check(const parser::ActionStmt &stmt, const parser::CharBlock &source) {
common::visit(
common::visitors{
+ [&](const common::Indirection<parser::StopStmt> &) {
+ return;
+ },
[&](const common::Indirection<parser::PrintStmt> &) {},
[&](const common::Indirection<parser::WriteStmt> &x) {
if (x.value().format) { // Formatted write to '*' or '6'
diff --git a/flang/test/Semantics/cuf09.cuf b/flang/test/Semantics/cuf09.cuf
index b45ca6d7d1a9d7..3307e2a8626729 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -49,6 +49,11 @@ module m
i = threadIdx%x
a(i) = c(10) ! ok, a is device and c is constant
end subroutine
+
+ attributes(global) subroutine stoptest()
+ print*,threadIdx%x
+ stop ! ok
+ end subroutine
end
program main
>From 9b828bc4459a9b93f41f2f0e1f3da9be74dd1fc4 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: Thu, 19 Dec 2024 11:41:16 -0800
Subject: [PATCH 2/2] Remove other code
---
flang/lib/Semantics/check-cuda.cpp | 4 ----
1 file changed, 4 deletions(-)
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index ba519a4f37d308..66e81b9ce26cb3 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -82,10 +82,6 @@ struct DeviceExprChecker
}
}
}
- // c_devloc is inlined in lowering.
- if (x.GetName().compare("c_devloc") == 0) {
- return {};
- }
} else if (x.GetSpecificIntrinsic()) {
// TODO(CUDA): Check for unsupported intrinsics here
return {};
More information about the flang-commits
mailing list