From 85a8aca84dbcb2451f7f3388fca51e234e2efeed Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Wed, 15 Oct 2025 14:05:55 -0700 Subject: [PATCH 1/2] [flang][cuda] Add TODO for allocate with device source --- flang/lib/Lower/Allocatable.cpp | 4 ++++ .../test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp index 460ed62d5337f..4b7a846c5e272 100644 --- a/flang/lib/Lower/Allocatable.cpp +++ b/flang/lib/Lower/Allocatable.cpp @@ -629,6 +629,10 @@ class AllocateStmtHelper { unsigned allocatorIdx = Fortran::lower::getAllocatorIdx(alloc.getSymbol()); fir::ExtendedValue exv = isSource ? sourceExv : moldExv; + if (const Fortran::semantics::Symbol * sym{GetLastSymbol(sourceExpr)}) + if (Fortran::semantics::IsCUDADevice(*sym)) + TODO(loc, "CUDA Fortran: allocate with device source"); + // Generate a sequence of runtime calls. errorManager.genStatCheck(builder, loc); genAllocateObjectInit(box, allocatorIdx); diff --git a/flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf b/flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf new file mode 100644 index 0000000000000..3e59e2f01119e --- /dev/null +++ b/flang/test/Lower/CUDA/TODO/cuda-allocate-source-device.cuf @@ -0,0 +1,9 @@ +! RUN: %not_todo_cmd bbc -emit-fir -fcuda -o - %s 2>&1 | FileCheck %s + +program main + implicit none + integer, device, allocatable :: a_d(:) + integer, allocatable :: a(:) +! CHECK: not yet implemented: CUDA Fortran: allocate with device source + allocate(a, source=a_d) +end program From 16d0951e88aea1943a8908552ad1b93d6cfbaa0a Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Wed, 15 Oct 2025 14:33:33 -0700 Subject: [PATCH 2/2] format --- flang/lib/Lower/Allocatable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/lib/Lower/Allocatable.cpp b/flang/lib/Lower/Allocatable.cpp index 4b7a846c5e272..e7a6c4df40045 100644 --- a/flang/lib/Lower/Allocatable.cpp +++ b/flang/lib/Lower/Allocatable.cpp @@ -629,7 +629,7 @@ class AllocateStmtHelper { unsigned allocatorIdx = Fortran::lower::getAllocatorIdx(alloc.getSymbol()); fir::ExtendedValue exv = isSource ? sourceExv : moldExv; - if (const Fortran::semantics::Symbol * sym{GetLastSymbol(sourceExpr)}) + if (const Fortran::semantics::Symbol *sym{GetLastSymbol(sourceExpr)}) if (Fortran::semantics::IsCUDADevice(*sym)) TODO(loc, "CUDA Fortran: allocate with device source");