[flang-commits] [flang] [OpenMP][Flang] Emit default declare mappers implicitly for derived types (PR #140562)
via flang-commits
flang-commits at lists.llvm.org
Fri Jul 25 05:32:06 PDT 2025
https://github.com/agozillon approved this pull request.
Hey Akash, this LGTM.
However, could you please add a test to the map-types-and-sizes.f90 test or create an equivalent for the mapper work! Would be good to keep track of what we expect the lowered LLVM-IR to be.
I also don't believe this PR handles more complicated mapping cases like below (please do correct me if I am wrong):
```
program main
type :: bottom_layer
integer(4), allocatable :: array_j3(:)
end type bottom_layer
type :: middle_layer
type(bottom_layer), allocatable :: nest
real(4), allocatable :: array_j2(:)
end type middle_layer
type :: top_layer
integer, allocatable :: array_j(:)
type(middle_layer), allocatable :: nested
end type top_layer
type(top_layer), allocatable :: top_dtype
allocate(top_dtype)
allocate(top_dtype%nested)
allocate(top_dtype%nested%nest)
allocate(top_dtype%array_j(10))
allocate(top_dtype%nested%array_j2(10))
allocate(top_dtype%nested%nest%array_j3(10))
!$omp target
top_dtype%array_j(1) = 10
top_dtype%nested%array_j2(1) = 20
top_dtype%nested%nest%array_j3(1) = 30
!$omp end target
print *, top_dtype%nested%nest%array_j3(1)
print *, top_dtype%nested%array_j2(1)
print *, top_dtype%array_j(1)
end program main
```
How difficult would it be to extend this work to handle the above cases? As I think that'd be the ideal next step for this work!
A really nice end goal for this work would be to handle slightly more complicated case than even the above with arbitrary nestings of array of allocatable derived types with allocatable types (arrays, scalars etc.)!
https://github.com/llvm/llvm-project/pull/140562
More information about the flang-commits
mailing list