From: Chung-Lin Tang <cltang@codesourcery.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
Fortran List <fortran@gcc.gnu.org>,
Jakub Jelinek <jakub@redhat.com>,
Thomas Schwinge <thomas@codesourcery.com>
Subject: Re: [PATCH, PR90030] Fortran OpenMP/OpenACC array mapping alignment fix
Date: Fri, 19 Nov 2021 21:55:04 +0800 [thread overview]
Message-ID: <fd9b632a-fadf-51f9-2d7f-314eac11f024@codesourcery.com> (raw)
In-Reply-To: <35d55ea5-73e1-7f6d-c941-37e21fe29da8@codesourcery.com>
Ping.
On 2021/11/4 4:23 PM, Chung-Lin Tang wrote:
> Hi Jakub,
> As Thomas reported and submitted a patch a while ago:
> https://gcc.gnu.org/pipermail/gcc-patches/2019-April/519932.html
> https://gcc.gnu.org/pipermail/gcc-patches/2019-May/522738.html
>
> There's an issue with the Fortran front-end when mapping arrays: when
> creating the data MEM_REF for the map clause, there's a convention of
> casting the referencing pointer to 'c_char *' by
> fold_convert (build_pointer_type (char_type_node), ptr).
>
> This causes the alignment passed to the libgomp runtime for array data
> hardwared to '1', and causes alignment errors on the offload target
> (not always showing up, but can trigger due to slight change of clause
> ordering)
>
> This patch is not exactly Thomas' patch from 2019, but does the same
> thing. The new libgomp tests are directly reused though. A lot of
> scan test adjustment is also included in this patch.
>
> Patch has been tested for no regressions for gfortran and libgomp, is
> this okay for trunk?
>
> Thanks,
> Chung-Lin
>
> Fortran: fix array alignment for OpenMP/OpenACC target mapping clauses [PR90030]
>
> The Fortran front-end is creating maps of array data with a type of pointer to
> char_type_node, which when eventually passed to libgomp during runtime, marks
> the passed array with an alignment of 1, which can cause mapping alignment
> errors on the offload target.
>
> This patch removes the related fold_convert(build_pointer_type (char_type_node))
> calls in fortran/trans-openmp.c, and adds gcc_asserts to ensure pointer type.
>
> 2021-11-04 Chung-Lin Tang <cltang@codesourcery.com>
> Thomas Schwinge <thomas@codesourcery.com>
>
> PR fortran/90030
>
> gcc/fortran/ChangeLog:
>
> * trans-openmp.c (gfc_omp_finish_clause): Remove fold_convert to pointer
> to char_type_node, add gcc_assert of POINTER_TYPE_P.
> (gfc_trans_omp_array_section): Likewise.
> (gfc_trans_omp_clauses): Likewise.
>
> gcc/testsuite/ChangeLog:
>
> * gfortran.dg/goacc/finalize-1.f: Adjust scan test.
> * gfortran.dg/gomp/affinity-clause-1.f90: Likewise.
> * gfortran.dg/gomp/affinity-clause-5.f90: Likewise.
> * gfortran.dg/gomp/defaultmap-4.f90: Likewise.
> * gfortran.dg/gomp/defaultmap-5.f90: Likewise.
> * gfortran.dg/gomp/defaultmap-6.f90: Likewise.
> * gfortran.dg/gomp/map-3.f90: Likewise.
> * gfortran.dg/gomp/pr78260-2.f90: Likewise.
> * gfortran.dg/gomp/pr78260-3.f90: Likewise.
>
> libgomp/ChangeLog:
>
> * testsuite/libgomp.oacc-fortran/pr90030.f90: New test.
> * testsuite/libgomp.fortran/pr90030.f90: New test.
next prev parent reply other threads:[~2021-11-19 13:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 8:23 Chung-Lin Tang
2021-11-19 13:55 ` Chung-Lin Tang [this message]
2021-12-01 16:11 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fd9b632a-fadf-51f9-2d7f-314eac11f024@codesourcery.com \
--to=cltang@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).