Skip to content

Commit 15c61a2

Browse files
authored
[flang][cuda] Do not consider SHARED array as host array (#120306)
Update the current `FindHostArray` to not return shared array as host array.
1 parent 97b7bac commit 15c61a2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

flang/lib/Semantics/check-cuda.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ struct FindHostArray
115115
(details->cudaDataAttr() &&
116116
*details->cudaDataAttr() != common::CUDADataAttr::Device &&
117117
*details->cudaDataAttr() != common::CUDADataAttr::Managed &&
118+
*details->cudaDataAttr() != common::CUDADataAttr::Shared &&
118119
*details->cudaDataAttr() != common::CUDADataAttr::Unified))) {
119120
return &symbol;
120121
}

flang/test/Semantics/cuf09.cuf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ module m
3535
i = threadIdx%x
3636
a(i) = i
3737
end subroutine
38+
39+
attributes(global) subroutine sharedarray(a)
40+
integer, device :: a(10)
41+
integer, shared :: s(10)
42+
i = threadIdx%x
43+
a(i) = s(10) ! ok, a is device and s is shared
44+
end subroutine
3845
end
3946

4047
program main

0 commit comments

Comments
 (0)