[flang-commits] [flang] ef11bdc - [flang][cuda] Allow compiler directive in cuda code (#141991)
via flang-commits
flang-commits at lists.llvm.org
Thu May 29 10:46:47 PDT 2025
Author: Valentin Clement (バレンタイン クレメン)
Date: 2025-05-29T10:46:44-07:00
New Revision: ef11bdc7fe43ed9d418795c56668a1c6f8c6e35f
URL: https://github.com/llvm/llvm-project/commit/ef11bdc7fe43ed9d418795c56668a1c6f8c6e35f
DIFF: https://github.com/llvm/llvm-project/commit/ef11bdc7fe43ed9d418795c56668a1c6f8c6e35f.diff
LOG: [flang][cuda] Allow compiler directive in cuda code (#141991)
Added:
Modified:
flang/lib/Semantics/check-cuda.cpp
flang/test/Semantics/cuf09.cuf
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index fd1ec2b2c69f8..c024640af1220 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -321,6 +321,9 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
Check(std::get<parser::Block>(c.t));
}
},
+ [&](const common::Indirection<parser::CompilerDirective> &x) {
+ // TODO(CUDA): Check for unsupported compiler directive here.
+ },
[&](const auto &x) {
if (auto source{parser::GetSource(x)}) {
context_.Say(*source,
diff --git a/flang/test/Semantics/cuf09.cuf b/flang/test/Semantics/cuf09.cuf
index 4a6d9ab09387d..1e23819f9afe8 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -18,6 +18,17 @@ module m
!WARNING: I/O statement might not be supported on device
write(12,'(10F4.1)'), x
end
+ attributes(global) subroutine devsub3(n)
+ implicit none
+ integer :: n
+ integer :: i, ig, iGrid
+ iGrid = gridDim%x*blockDim%x
+ ig = (blockIdx%x-1)*blockDim%x + threadIdx%x
+
+ !dir$ nounroll
+ do i = ig, n, iGrid
+ end do
+ end subroutine
attributes(global) subroutine hostglobal(a)
integer :: a(*)
i = threadIdx%x
More information about the flang-commits
mailing list