From 15c61a208ffdd0bfe6add667cf9e56df1fdbf16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Tue, 17 Dec 2024 13:42:14 -0800 Subject: [PATCH] [flang][cuda] Do not consider SHARED array as host array (#120306) Update the current `FindHostArray` to not return shared array as host array. --- flang/lib/Semantics/check-cuda.cpp | 1 + flang/test/Semantics/cuf09.cuf | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp index d8c9db224173..15ee5f32f69b 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 e2247da961f7..7452ee7cd7dc 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