[flang-commits] [flang] [flang][cuda] Do not consider SHARED array as host array (PR #120306)
via flang-commits
flang-commits at lists.llvm.org
Tue Dec 17 13:35:37 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Valentin Clement (バレンタイン クレメン) (clementval)
<details>
<summary>Changes</summary>
Update the current `FindHostArray` to not return shared array as host array.
---
Full diff: https://github.com/llvm/llvm-project/pull/120306.diff
2 Files Affected:
- (modified) flang/lib/Semantics/check-cuda.cpp (+1)
- (modified) flang/test/Semantics/cuf09.cuf (+7)
``````````diff
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index 9c044a47c79834..7e458d3b55a89c 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -114,6 +114,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 e0ca814aec26a0..3a9efecbdb60b7 100644
--- a/flang/test/Semantics/cuf09.cuf
+++ b/flang/test/Semantics/cuf09.cuf
@@ -28,6 +28,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
``````````
</details>
https://github.com/llvm/llvm-project/pull/120306
More information about the flang-commits
mailing list