[flang-commits] [flang] 15c61a2 - [flang][cuda] Do not consider SHARED array as host array (#120306)
via flang-commits
flang-commits at lists.llvm.org
Tue Dec 17 13:42:17 PST 2024
Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-12-17T13:42:14-08:00
New Revision: 15c61a208ffdd0bfe6add667cf9e56df1fdbf16e
URL: https://github.com/llvm/llvm-project/commit/15c61a208ffdd0bfe6add667cf9e56df1fdbf16e
DIFF: https://github.com/llvm/llvm-project/commit/15c61a208ffdd0bfe6add667cf9e56df1fdbf16e.diff
LOG: [flang][cuda] Do not consider SHARED array as host array (#120306)
Update the current `FindHostArray` to not return shared array as host
array.
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 d8c9db22417398..15ee5f32f69b19 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -115,6 +115,7 @@ struct FindHostArray
(details->cudaDataAttr() &&
*details->cudaDataAttr() != common::CUDADataAttr::Device &&
*details->cudaDataAttr() != common::CUDADataAttr::Managed &&
+ *details->cudaDataAttr() != common::CUDADataAttr::Shared &&
*details->cudaDataAttr() != common::CUDADataAttr::Unified))) {
return &symbol;
}
diff --git a/flang/test/Semantics/cuf09.cuf b/flang/test/Semantics/cuf09.cuf
index e2247da961f7ee..7452ee7cd7dc6a 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -35,6 +35,13 @@ module m
i = threadIdx%x
a(i) = i
end subroutine
+
+ attributes(global) subroutine sharedarray(a)
+ integer, device :: a(10)
+ integer, shared :: s(10)
+ i = threadIdx%x
+ a(i) = s(10) ! ok, a is device and s is shared
+ end subroutine
end
program main
More information about the flang-commits
mailing list