Skip to content

Commit b53e545

Browse files
clementvalsvkeerthy
authored andcommitted
[flang][cuda] Allow compiler directive in cuda code (#141991)
1 parent ca5b52f commit b53e545

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

flang/lib/Semantics/check-cuda.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
321321
Check(std::get<parser::Block>(c.t));
322322
}
323323
},
324+
[&](const common::Indirection<parser::CompilerDirective> &x) {
325+
// TODO(CUDA): Check for unsupported compiler directive here.
326+
},
324327
[&](const auto &x) {
325328
if (auto source{parser::GetSource(x)}) {
326329
context_.Say(*source,

flang/test/Semantics/cuf09.cuf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ module m
1818
!WARNING: I/O statement might not be supported on device
1919
write(12,'(10F4.1)'), x
2020
end
21+
attributes(global) subroutine devsub3(n)
22+
implicit none
23+
integer :: n
24+
integer :: i, ig, iGrid
25+
iGrid = gridDim%x*blockDim%x
26+
ig = (blockIdx%x-1)*blockDim%x + threadIdx%x
27+
28+
!dir$ nounroll
29+
do i = ig, n, iGrid
30+
end do
31+
end subroutine
2132
attributes(global) subroutine hostglobal(a)
2233
integer :: a(*)
2334
i = threadIdx%x

0 commit comments

Comments
 (0)