- Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
Description
The OpenMP standard v5.2 p289 and p166-168 resp. defines that custom mappers can be used in target update constructs with to and from:
!$omp target update to(mapper(custom): typ))
!$omp target update from(mapper(custom): typ))
where one could imagine using the feature in a code similar to the snippet:
PROGRAM main IMPLICIT NONE INTEGER, PARAMETER :: n = 4 TYPE :: typ INTEGER, ALLOCATABLE :: a(:) INTEGER, ALLOCATABLE :: b(:) END TYPE typ !$omp declare mapper(custom: typ :: t) map(t%a) TYPE(typ) :: t ALLOCATE(t%a(n), source=1) ALLOCATE(t%b(n), source=2) !$omp target enter data map(alloc: t) t%a = 42 ! Modify on host !$omp target update to(mapper(custom): t) !$omp target t%a(:) = t%a(:) / 2 ! Modify on device t%b(:) = -1 ! Should not be copied back with custom mapper !$omp end target !$omp target update from(mapper(custom): t) PRINT*, t%a ! Expect: 21 21 21 21 PRINT*, t%b ! Expect: 2 2 2 2 !$omp target exit data map(delete: t) DEALLOCATE(t%a) DEALLOCATE(t%b) END PROGRAM mainWhen compiling this with latest flang, the compiler does not recognize the mappers:
> flang -O2 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-version=52 main.F90 warning: OpenMP support for version 52 in flang is still incomplete error: Semantic errors in main.F90 ./main.F90:18:35: error: Internal: no symbol found for 'custom' !$omp target update to(mapper(custom): t) ^^^^^^ ./main.F90:24:37: error: Internal: no symbol found for 'custom' !$omp target update from(mapper(custom): t) I am not sure if this is a bug or if the feature is not implemented but since there has been great progress on custom mappers lately, I suspect that the infrastructure to implement it might exist already.
For reference, I am using flang version 22.0.0git (git@github.com:llvm/llvm-project.git ee1abb8d80691e5ef24da3273587dc789c9c6f1b)