mbox series

[v3,0/5] openmp: Add support for iterators in OpenMP mapping clauses

Message ID 6b94b8ed-020b-47e2-b02a-4891891f2847@baylibre.com
Headers show
Series openmp: Add support for iterators in OpenMP mapping clauses | expand

Message

Kwok Cheung Yeung Oct. 4, 2024, 2:53 p.m. UTC
This is a further improved patch series to that posted at:
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662138.html

The main change is that the expansion of the iterators is pushed back 
further to the omp-lowering stage. This is because the recently 
committed deep-mapping support (and features such as strided array 
updates in the OpenMP development branch) do their work in the omplower 
stage, but the iterators need to be expanded after any changes to the 
clauses and their decls/sizes have occurred. This patch set does not 
support deep-mapping yet - it just emits a sorry when this happens.

The iterator expansion now does not happen all at once. A new loop is 
generated the first time a clause with a new iterator is found, and is 
reused if the same iterator is used in another clause. Assigning the 
clause decl and size in the iterator loop are now done by calling 
separate functions from lower_target, which also return the new 
hostaddr/size expression from the iterator loop that should be passed to 
libgomp. This fits in better with the existing code structure. A final 
function is called to finalise all the loops. As multiple sets of loops 
can be 'in-flight' at once, a new structure and a hash map are used to 
keep track of their states.

Instead of making the OMP_CLAUSE_DECL into a tree list with the iterator 
in TREE_PURPOSE and original decl in TREE_VALUE, I have stored the 
iterator in a third argument in the clause tree node addressed by 
OMP_CLAUSE_ITERATOR instead. In this way, changes do not have to be made 
in the intervening code-path to extract the original OMP_CLAUSE_DECL 
(which is messy and error-prone), allowing code unrelated to iterators 
to go unmodified. Nearly all special-cases for iterators have now been 
removed.

I have also fixed some issues detected by Linaro CI - some format 
specifier issues, and some tests that expect a non-unified target 
address space failing.

Gomp GCC tests and libgomp tests run on x86_64 host with Nvidia 
offloading. Okay for trunk?

Kwok