[flang] [llvm] [flang][cuda] Pass allocator index to allocate functions (PR #157189)

Valentin Clement バレンタイン クレメン via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 6 07:46:14 PDT 2025


================
@@ -23,11 +23,11 @@ namespace Fortran::runtime::cuda {
 extern "C" {
 RT_EXT_API_GROUP_BEGIN
 
-int RTDEF(CUFAllocatableAllocateSync)(Descriptor &desc, int64_t *stream,
-    bool *pinned, bool hasStat, const Descriptor *errMsg,
+int RTDEF(CUFAllocatableAllocateSync)(Descriptor &desc, int32_t allocIdx,
----------------
clementval wrote:

Yes in most cases the allocator is set correctly. The problem comes when you have allocable device components in a derived type.
If the derived type itself is an allocatable array then it becomes tricky to initialize the allocator index correctly at the right time. Since we have the information at hand on the allocate statement of the component it seems easier to pass it at that time. 
Let me know if you have another idea. I was thinking to use the set_allocator_idx operation but it feels like an extra runtime call that can be embedded with the cuf.allocate for this corner case. 

https://github.com/llvm/llvm-project/pull/157189


More information about the llvm-commits mailing list