[flang-commits] [flang] Skip POINTER components in implicit mapper generation (PR #177848)

Jakob Fuchs via flang-commits flang-commits at lists.llvm.org
Wed Aug 26 06:06:38 PDT 2026


jfuchs-kmt wrote:

> > Interesting, I would have hoped to get the output you saw on my system. I have been testing this issue on an NVIDIA RTX 5070 Ti only so far. I compiled with `flang -fopenmp --offload-arch=sm_120 -fopenmp-version=52 main.F90`. Running with `LIBOMPTARGET_INFO=-1 ./a.out` shows that offloading is happening.
> > I have a Radeon Pro AI R9700 to my disposal where I would like to test this as well, but I could not build LLVM using `offload/cmake/caches/FlangOffoad.cmake` for the last month or so due to build failures.
> 
> Unfortunately I don't have access to an NVIDIA card, please do try the offload mandatory just incase. However, can you share the map entries the trace produces? From my understanding nothing the compiler emits at a Flang -> LLVM-IR lowering level should produce the extra mappings required for the pointers data to be mapped, and there isn't anything we produce that I'm aware of that's NVIDIA specific that would cause a deep-copy here.

I changed the number of elements so you can see it more clearly in the mappings, now `n=100` --> 400 bytes:
```
OMP_TARGET_OFFLOAD=mandatory LIBOMPTARGET_INFO=-1 ./a.out

CUDA device 0 info: The primary context is inactive, set its flags to CU_CTX_SCHED_BLOCKING_SYNC
omptarget device 0 info: Entering OpenMP kernel at unknown:0:0 with 6 arguments:
omptarget device 0 info: to(obj)[48] 
omptarget device 0 info: alloc(arr)[48] 
omptarget device 0 info: to(arr)[48] 
omptarget device 0 info: tofrom(arr)[400] 
omptarget device 0 info: firstprivate(unknown)[4] (implicit)
omptarget device 0 info: attach(arr)[48] 
omptarget device 0 info: Copying data from host to device, HstPtr=0x00007ffd1be5a580, TgtPtr=0x0000706d0e600000, Size=48, Name=unknown
omptarget device 0 info: Creating new map entry with HstPtrBase=0x00005d06076a3240, HstPtrBegin=0x00005d06076a3240, TgtAllocBegin=0x0000706d03c00000, TgtPtrBegin=0x0000706d03c00000, Size=48, DynRefCount=1, HoldRefCount=0, Name=obj
omptarget device 0 info: Copying data from host to device, HstPtr=0x00005d06076a3240, TgtPtr=0x0000706d03c00000, Size=48, Name=obj
omptarget device 0 info: Creating new map entry with HstPtrBase=0x00005d06076a3210, HstPtrBegin=0x00005d06076a3210, TgtAllocBegin=0x0000706d03c00200, TgtPtrBegin=0x0000706d03c00200, Size=48, DynRefCount=1, HoldRefCount=0, Name=arr
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3210, TgtPtrBegin=0x0000706d03c00200, Size=48, DynRefCount=1 (update suppressed), HoldRefCount=0, Name=arr
omptarget device 0 info: Copying data from host to device, HstPtr=0x00005d06076a3210, TgtPtr=0x0000706d03c00200, Size=48, Name=arr
omptarget device 0 info: Creating new map entry with HstPtrBase=0x00005d06076a3210, HstPtrBegin=0x00005d06314fec80, TgtAllocBegin=0x0000706d03c00400, TgtPtrBegin=0x0000706d03c00400, Size=400, DynRefCount=1, HoldRefCount=0, Name=arr
omptarget device 0 info: Copying data from host to device, HstPtr=0x00005d06314fec80, TgtPtr=0x0000706d03c00400, Size=400, Name=arr
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06314fec80, TgtPtrBegin=0x0000706d03c00400, Size=0, DynRefCount=1 (update suppressed), HoldRefCount=0
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3210, TgtPtrBegin=0x0000706d03c00200, Size=48, DynRefCount=1 (update suppressed), HoldRefCount=0
omptarget device 0 info: Copying data from host to device, HstPtr=0x00005d0632b32cb0, TgtPtr=0x0000706d03c00200, Size=48, Name=arr
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3240, TgtPtrBegin=0x0000706d03c00000, Size=48, DynRefCount=1 (update suppressed), HoldRefCount=0
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3210, TgtPtrBegin=0x0000706d03c00200, Size=48, DynRefCount=1 (update suppressed), HoldRefCount=0
PluginInterface device 0 info: Launching kernel __omp_offloading_10304_70b9ce__QQmain_l16 with [4,1,1] blocks and [32,1,1] threads in SPMD mode
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06314fec80, TgtPtrBegin=0x0000706d03c00400, Size=400, DynRefCount=0 (decremented, delayed deletion), HoldRefCount=0
omptarget device 0 info: Copying data from device to host, TgtPtr=0x0000706d03c00400, HstPtr=0x00005d06314fec80, Size=400, Name=arr
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3210, TgtPtrBegin=0x0000706d03c00200, Size=48, DynRefCount=1 (update suppressed), HoldRefCount=0
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3210, TgtPtrBegin=0x0000706d03c00200, Size=48, DynRefCount=0 (decremented, delayed deletion), HoldRefCount=0
omptarget device 0 info: Mapping exists with HstPtrBegin=0x00005d06076a3240, TgtPtrBegin=0x0000706d03c00000, Size=48, DynRefCount=0 (decremented, delayed deletion), HoldRefCount=0
omptarget device 0 info: Removing map entry with HstPtrBegin=0x00005d06314fec80, TgtPtrBegin=0x0000706d03c00400, Size=400, Name=arr
omptarget device 0 info: Removing map entry with HstPtrBegin=0x00005d06076a3210, TgtPtrBegin=0x0000706d03c00200, Size=48, Name=arr
omptarget device 0 info: Removing map entry with HstPtrBegin=0x00005d06076a3240, TgtPtrBegin=0x0000706d03c00000, Size=48, Name=obj
omptarget device 0 info: OpenMP Host-Device pointer mappings table empty
 arr back on host: 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.
 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.
 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.
 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.
 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42. 42.
 42. 42. 42. 42. 42. 42. 42. 42. 42.
omptarget device 0 info: OpenMP Host-Device pointer mappings table empty
```

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


More information about the flang-commits mailing list