[flang-commits] [flang] a1418ac - [flang][cuda] Disable host array check when unified is enabled (#191054)
via flang-commits
flang-commits at lists.llvm.org
Wed Apr 8 14:43:10 PDT 2026
Author: Valentin Clement (バレンタイン クレメン)
Date: 2026-04-08T14:43:06-07:00
New Revision: a1418ac932a95113b72020e73e8f9d7808f25973
URL: https://github.com/llvm/llvm-project/commit/a1418ac932a95113b72020e73e8f9d7808f25973
DIFF: https://github.com/llvm/llvm-project/commit/a1418ac932a95113b72020e73e8f9d7808f25973.diff
LOG: [flang][cuda] Disable host array check when unified is enabled (#191054)
Added:
flang/test/Lower/CUDA/cuda-unified.cuf
Modified:
flang/lib/Semantics/check-cuda.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-cuda.cpp b/flang/lib/Semantics/check-cuda.cpp
index fcfbf29972ca9..62ece9e57b5d6 100644
--- a/flang/lib/Semantics/check-cuda.cpp
+++ b/flang/lib/Semantics/check-cuda.cpp
@@ -439,6 +439,9 @@ template <bool IsCUFKernelDo> class DeviceContextChecker {
void ErrorIfHostSymbol(const A &expr, parser::CharBlock source) {
if (isHostDevice)
return;
+ if (context_.languageFeatures().IsEnabled(
+ common::LanguageFeature::CudaUnified))
+ return;
if (const Symbol * hostArray{FindHostArray{}(expr)}) {
context_.Say(source,
"Host array '%s' cannot be present in device context"_err_en_US,
diff --git a/flang/test/Lower/CUDA/cuda-unified.cuf b/flang/test/Lower/CUDA/cuda-unified.cuf
new file mode 100644
index 0000000000000..167f35e3beba2
--- /dev/null
+++ b/flang/test/Lower/CUDA/cuda-unified.cuf
@@ -0,0 +1,12 @@
+! RUN: bbc -emit-hlfir -fcuda -gpu=unified %s -o - | FileCheck %s
+
+program t
+real :: a(10000)
+!$cuf kernel do(1) <<<100,100>>>
+do concurrent (i = 1:10000)
+ a(i) = a(i) + 1.0
+end do
+print *,sum(a)
+end
+
+! CHECK: cuf.kernel
More information about the flang-commits
mailing list