OpenMP: Fortran target constructs gain map iterator support
GCC now supports iterators in 'map' clauses of OpenMP 'target' constructs in Fortran, enabling more flexible data mapping for offloading.
This GCC update enhances the Fortran front-end to support iterators within ‘map’ clauses of OpenMP ‘target’ constructs. This allows Fortran programmers to use iterative patterns when defining which data should be moved to and from accelerator devices for parallel computation. The change also includes special handling in libgomp for mapping arrays of derived types, ensuring correct behavior for complex data structures.
In Details
This change integrates iterator support into OpenMP 'map' clauses within the Fortran front-end. Key modifications occur in gcc/fortran/openmp.cc, trans-openmp.cc, and gcc/gimplify.cc. gfc_match_omp_clauses and resolve_omp_clauses now recognize and process iterator modifiers for OMP_LIST_MAP. gfc_trans_omp_array_section has been updated to accept an iterator argument and handle iterator variables when computing biases. The gimplify.cc changes, particularly compute_omp_iterator_count and build_omp_iterator_loop, ensure correct loop boundary conditions for Fortran and embed b…
For Context
This GCC update improves how Fortran programs can use OpenMP for parallel computing, especially when sending data to specialized hardware like GPUs. Specifically, it adds support for 'iterators' in what are called 'map' clauses within OpenMP 'target' constructs. Imagine you have a large array or a complex data structure in your Fortran program, and you want to process parts of it on a GPU. A 'map' clause tells the compiler which data to move. With 'iterators', you can now dynamically specify ranges or patterns of this data to be moved, rather than just fixed regions. This makes it much more flexible and efficient to manage data transfer for parallel tasks, particularly for complex Fortran data types, allowing for faster execution of scientific and engineering applications.