[PATCH, 1/8] Expand oacc kernels after pass_build_ealias

Tom de Vries Tom_deVries@mentor.com
Sat Nov 15 17:21:00 GMT 2014


On 15-11-14 13:14, Tom de Vries wrote:
> Hi,
>
> I'm submitting a patch series with initial support for the oacc kernels directive.
>
> The patch series uses pass_parallelize_loops to implement parallelization of
> loops in the oacc kernels region.
>
> The patch series consists of these 8 patches:
> ...
>      1  Expand oacc kernels after pass_build_ealias
>      2  Add pass_oacc_kernels
>      3  Add pass_ch_oacc_kernels to pass_oacc_kernels
>      4  Add pass_tree_loop_{init,done} to pass_oacc_kernels
>      5  Add pass_loop_im to pass_oacc_kernels
>      6  Add pass_ccp to pass_oacc_kernels
>      7  Add pass_parloops_oacc_kernels to pass_oacc_kernels
>      8  Do simple omp lowering for no address taken var
> ...

This patch moves omp expansion of the oacc kernels directive to after 
pass_build_ealias.

The rationale is that in order to use pass_parallelize_loops for analysis and 
transformation of an oacc kernels region, we postpone omp expansion of that 
region until the earliest point in the pass list where enough information is 
availabe to run pass_parallelize_loops, in other words, after pass_build_ealias.

The patch postpones expansion in expand_omp, and ensures expansion by adding 
pass_expand_omp_ssa:
- after pass_build_ealias, and
- after pass_all_early_optimizations for the case we're not optimizing.

In order to make sure the oacc kernels region arrives at pass_expand_omp_ssa, 
the way it left expand_omp, the patch makes pass_ccp and pass_forwprop aware of 
lowered omp code, to handle it conservatively.

The patch contains changes in expand_omp_target to deal with ssa-code, similar 
to what is already present in expand_omp_taskreg.

Furthermore, the patch forces the .omp_data_sizes and .omp_data_kinds to not be 
static for oacc kernels. It does this to get some references to .omp_data_sizes 
and .omp_data_kinds in the ssa code.  Without these references, the definitions 
will be removed. The reference of the variables in GIMPLE_OACC_KERNELS is not 
enough to have them not removed. [ In vries/oacc-kernels, I used a BUILT_IN_USE 
kludge for this purpose ].

Finally, at the end of pass_expand_omp_ssa we're left with SSA_NAMEs in the 
original function of which the definition has been removed (as in moved to the 
split off function). TODO_remove_unused_locals takes care of some of them, but 
not the anonymous ones. So the patch iterates over all SSA_NAMEs to find these 
dangling SSA_NAMEs and releases them.

OK for trunk?

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Expand-oacc-kernels-after-pass_build_ealias.patch
Type: text/x-patch
Size: 15582 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141115/0474db08/attachment.bin>


More information about the Gcc-patches mailing list