public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/105358] [12 Regression] scan* fails on targets without aligned memory allocators.
Date: Tue, 26 Apr 2022 07:15:46 +0000	[thread overview]
Message-ID: <bug-105358-4-I375uDo6ma@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105358-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105358

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:57a957cb71c004de80b0fd30c8db3cc67576e0ce

commit r12-8259-g57a957cb71c004de80b0fd30c8db3cc67576e0ce
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Apr 26 08:57:17 2022 +0200

    libgomp: Fix up two non-GOMP_USE_ALIGNED_WORK_SHARES related issues
[PR105358]

    Last fall I've changed struct gomp_work_share, so that it doesn't have
    __attribute__((aligned (64))) lock member in the middle unless the target
has
    non-emulated aligned allocator, otherwise it just makes sure the first and
    second halves are 64 bytes appart for cache line reasons, but doesn't make
    the struct 64-byte aligned itself and so we can use normal allocators for
it.

    When the struct isn't 64-byte aligned, the amount of tail padding
significantly
    decreases, to 0 or 4 bytes or so.  The library uses that tail padding when
    the ordered_teams_ids array (array of uints) and/or the memory for
lastprivate
    conditional temporaries (the latter wants to guarantee long long
alignment).
    The problem with it on ia32 darwin9 is that while the struct contains
    long long members, long long is just 4 byte aligned while __alignof__(long
long)
    is 8.  That causes problems in gomp_init_work_share, where we currently
rely on
    if offsetof (struct gomp_work_share, inline_ordered_team_ids) is long long
    aligned, then that tail array will be aligned at runtime and so no extra
    memory for dynamic realignment will be needed (that is false when the whole
    struct doesn't have long long alignment).  And also in the remaining hunks
    causes another problem, where we compute INLINE_ORDERED_TEAM_IDS_OFF
    as the above offsetof aligned up to long long boundary and subtract
    sizeof (struct gomp_work_share) and INLINE_ORDERED_TEAM_IDS_OFF.
    When unlucky, the former isn't multiple of 8 and the latter is 4 bigger
    than that and as the subtraction is done in size_t, we end up with (size_t)
-4,
    so the comparison doesn't really work.

    The fixes add additional conditions to make it work properly, but all of
them
    should be evaluated at compile time when optimizing and so shouldn't slow
    anything.

    2022-04-26  Jakub Jelinek  <jakub@redhat.com>

            PR libgomp/105358
            * work.c (gomp_init_work_share): Don't mask of adjustment for
            dynamic long long realignment if struct gomp_work_share has smaller
            alignof than long long.
            * loop.c (GOMP_loop_start): Don't use inline_ordered_team_ids if
            struct gomp_work_share has smaller alignof than long long or if
            sizeof (struct gomp_work_share) is smaller than
            INLINE_ORDERED_TEAM_IDS_OFF.
            * loop_ull.c (GOMP_loop_ull_start): Likewise.
            * sections.c (GOMP_sections2_start): Likewise.

  parent reply	other threads:[~2022-04-26  7:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23 12:00 [Bug libgomp/105358] New: " iains at gcc dot gnu.org
2022-04-25  6:52 ` [Bug libgomp/105358] " rguenth at gcc dot gnu.org
2022-04-25  9:04 ` jakub at gcc dot gnu.org
2022-04-25  9:21 ` jakub at gcc dot gnu.org
2022-04-25  9:59 ` iains at gcc dot gnu.org
2022-04-25 11:19 ` jakub at gcc dot gnu.org
2022-04-25 11:34 ` jakub at gcc dot gnu.org
2022-04-25 11:44 ` iains at gcc dot gnu.org
2022-04-25 11:46 ` iains at gcc dot gnu.org
2022-04-25 11:47 ` jakub at gcc dot gnu.org
2022-04-25 22:19 ` iains at gcc dot gnu.org
2022-04-26  7:15 ` cvs-commit at gcc dot gnu.org [this message]
2022-04-26  8:15 ` jakub at gcc dot gnu.org

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=bug-105358-4-I375uDo6ma@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).