OpenACC 'kernels' decomposition: Move 'TREE_ADDRESSABLE' setting into OMP lowering [PR100280]

Thomas Schwinge thomas@codesourcery.com
Fri Mar 4 13:41:47 GMT 2022


Hi!

On 2022-01-13T10:54:16+0100, I wrote:
> On 2019-05-08T14:51:57+0100, Julian Brown <julian@codesourcery.com> wrote:
>>  - The "addressable" bit is set during the kernels conversion pass for
>>    variables that have "create" (alloc) clauses created for them in the
>>    synthesised outer data region (instead of in the front-end, etc.,
>>    where it can't be done accurately). Such variables actually have
>>    their address taken during transformations made in a later pass
>>    (omp-low, I think), but there's a phase-ordering problem that means
>>    the flag should be set earlier.
>
> The actual issue is a bit different, but yes, there is a problem.
> The related ICE has also been reported as <https://gcc.gnu.org/PR100280>
> "ICE in lower_omp_target, at omp-low.c:12287".  (And I'm confused why we
> didn't run into that with the OpenACC 'kernels' decomposition
> originally.)  I've pushed to master branch
> commit 9b32c1669aad5459dd053424f9967011348add83
> "OpenACC 'kernels' decomposition: Mark variables used in synthesized data
> clauses as addressable [PR100280]", see attached.

> --- a/gcc/omp-oacc-kernels-decompose.cc
> +++ b/gcc/omp-oacc-kernels-decompose.cc
> @@ -793,7 +793,8 @@ make_data_region_try_statement (location_t loc, gimple *body)
>
>  /* If INNER_BIND_VARS holds variables, build an OpenACC data region with
>     location LOC containing BODY and having 'create (var)' clauses for each
> -   variable.  If INNER_CLEANUP is present, add a try-finally statement with
> +   variable (as a side effect, such variables also get TREE_ADDRESSABLE set).
> +   If INNER_CLEANUP is present, add a try-finally statement with
>     this cleanup code in the finally block.  Return the new data region, or
>     the original BODY if no data region was needed.  */
>
> @@ -842,6 +843,9 @@ maybe_build_inner_data_region (location_t loc, gimple *body,
>         inner_data_clauses = new_clause;
>
>         prev_mapped_var = v;
> +
> +       /* See <https://gcc.gnu.org/PR100280>.  */
> +       TREE_ADDRESSABLE (v) = 1;
>       }
>      }

Pushed to master branch commit de6e81ea961219d0726db67776d11ce75a4cae1b
"OpenACC 'kernels' decomposition: Move 'TREE_ADDRESSABLE' setting into
OMP lowering [PR100280]", see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OpenACC-kernels-decomposition-Move-TREE_ADDRESSABLE-.patch
Type: text/x-diff
Size: 21644 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20220304/feb5c2f8/attachment.bin>


More information about the Fortran mailing list