From aa7c104124ac4a8da12fbd25c797bc8ab438c545 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: Fri, 19 Apr 2024 12:47:40 -0700 Subject: [flang][cuda] Allow fixed size array with the managed attribute (#89436) Fixed size array and scalar should be allowed with the `managed` attribute. --- flang/lib/Semantics/check-declarations.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'flang/lib/Semantics') diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp index 875929e..adbd21d 100644 --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -956,9 +956,9 @@ void CheckHelper::CheckObjectEntity( break; case common::CUDADataAttr::Managed: if (!IsAutomatic(symbol) && !IsAllocatable(symbol) && - !details.isDummy()) { + !details.isDummy() && !evaluate::IsExplicitShape(symbol)) { messages_.Say( - "Object '%s' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, or a dummy argument"_err_en_US, + "Object '%s' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, explicit shape, or a dummy argument"_err_en_US, symbol.name()); } break; -- cgit v1.1 From 16e3464852efe3001060ff7feb3261dd397bfe84 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: Fri, 19 Apr 2024 14:58:22 -0700 Subject: [flang][cuda] Enforce PINNED attribute when ALLOCATE with PINNED option (#89455) When the PINNED option is specified on an ALLOCATE statement, the object must have the PINNED attribute. --- flang/lib/Semantics/check-allocate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'flang/lib/Semantics') diff --git a/flang/lib/Semantics/check-allocate.cpp b/flang/lib/Semantics/check-allocate.cpp index a7244e1..7bfd862 100644 --- a/flang/lib/Semantics/check-allocate.cpp +++ b/flang/lib/Semantics/check-allocate.cpp @@ -611,6 +611,13 @@ bool AllocationCheckerHelper::RunChecks(SemanticsContext &context) { return false; } } + if (allocateInfo_.gotPinned) { + std::optional cudaAttr{GetCUDADataAttr(ultimate_)}; + if (!cudaAttr || *cudaAttr != common::CUDADataAttr::Pinned) { + context.Say(name_.source, + "Object in ALLOCATE must have PINNED attribute when PINNED option is specified"_err_en_US); + } + } return RunCoarrayRelatedChecks(context); } -- cgit v1.1 From 4523a267829c807f3fc8fab8e5e9613985a51565 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: Fri, 19 Apr 2024 15:19:37 -0700 Subject: [flang][cuda] Enforce DEVICE attribute when ALLOCATE with STREAM option (#89459) When the STREAM option is specified on an ALLOCATE statement, the object must have the DEVICE attribute. --- flang/lib/Semantics/check-allocate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'flang/lib/Semantics') diff --git a/flang/lib/Semantics/check-allocate.cpp b/flang/lib/Semantics/check-allocate.cpp index 7bfd862..b4c5660 100644 --- a/flang/lib/Semantics/check-allocate.cpp +++ b/flang/lib/Semantics/check-allocate.cpp @@ -618,6 +618,13 @@ bool AllocationCheckerHelper::RunChecks(SemanticsContext &context) { "Object in ALLOCATE must have PINNED attribute when PINNED option is specified"_err_en_US); } } + if (allocateInfo_.gotStream) { + std::optional cudaAttr{GetCUDADataAttr(ultimate_)}; + if (!cudaAttr || *cudaAttr != common::CUDADataAttr::Device) { + context.Say(name_.source, + "Object in ALLOCATE must have DEVICE attribute when STREAM option is specified"_err_en_US); + } + } return RunCoarrayRelatedChecks(context); } -- cgit v1.1