From cff5facb91cd847d3beb86610b78814ad5a23f92 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Fri, 9 Oct 2026 23:12:21 -0400 Subject: [PATCH] Fix GPU_HOST_DATA and GPU_DECLARE argument handling GPU_HOST_DATA with both use_device_addr and use_device_ptr tried to assign into a Python string, which fails at Fypp time. Join the two bracketed lists into one instead. GPU_DECLARE passed extraAccArgs=None to ACC_DECLARE, silently dropping the caller's value. Pass it through. Verified with Fypp: a scratch file using both macros now expands to '!$acc host_data use_device(a, b, c)' / '!$omp target data use_device_addr(a, b) use_device_ptr(c)' and keeps extraAccArgs on '!$acc declare'. Fypp output for every pre_process, simulation, post_process and common source is byte-identical before and after for MFC_COMPILER = NVHPC, LLVMFlang and Cray, since no existing call site uses either path. --- src/common/include/parallel_macros.fpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/common/include/parallel_macros.fpp b/src/common/include/parallel_macros.fpp index b1382ec49a..f07420eb2d 100644 --- a/src/common/include/parallel_macros.fpp +++ b/src/common/include/parallel_macros.fpp @@ -114,7 +114,7 @@ #:def GPU_DECLARE(copy=None, copyin=None, copyinReadOnly=None, copyout=None, create=None, present=None, deviceptr=None, & & link=None, extraAccArgs=None, extraOmpArgs=None) #:set acc_code = ACC_DECLARE(copy=copy, copyin=copyin, copyinReadOnly=copyinReadOnly, copyout=copyout, create=create, & - & present=present, deviceptr=deviceptr, link=link, extraAccArgs=None) + & present=present, deviceptr=deviceptr, link=link, extraAccArgs=extraAccArgs) #:assert copyout is None #:assert present is None #:assert deviceptr is None @@ -165,10 +165,7 @@ ! Host code with device pointers (for MPI with GPU buffers) #:def GPU_HOST_DATA(code, use_device_addr=None, use_device_ptr=None, extraAccArgs=None, extraOmpArgs=None) #:if use_device_addr is not None and use_device_ptr is not None - #:set use_device_addr_end_index = len(use_device_addr) - 1 - #:set use_device = use_device_addr + use_device_ptr - $:use_device[use_device_addr_end_index] = ',' - $:use_device[use_device_addr_end_index + 1] = ' ' + #:set use_device = use_device_addr.strip()[:-1] + ', ' + use_device_ptr.strip()[1:] #:elif use_device_addr is not None or use_device_ptr is not None #:if use_device_addr is not None #:set use_device = use_device_addr