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 fortran/95654] nvptx offloading: FAIL: libgomp.fortran/pr66199-5.f90   -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions  execution test
Date: Mon, 05 Oct 2020 06:54:30 +0000	[thread overview]
Message-ID: <bug-95654-4-TEpPPQyHSP@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95654-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@gcc.gnu.org>:

https://gcc.gnu.org/g:ab3f4b27abe8abc947e84ef84bfc9a18797c5868

commit r11-3648-gab3f4b27abe8abc947e84ef84bfc9a18797c5868
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Sep 22 16:38:07 2020 +0200

    [omp, ftracer] Don't duplicate blocks in SIMT region

    When running the libgomp testsuite on x86_64-linux with nvptx accelerator
on
    the test-case included in this patch, we run into:
    ...
    FAIL: libgomp.fortran/pr95654.f90 -O3 -fomit-frame-pointer -funroll-loops \
      -fpeel-loops -ftracer -finline-functions  execution test
    ...

    The test-case is a minimal version of this FAIL:
    ...
    FAIL: libgomp.fortran/pr66199-5.f90 -O3 -fomit-frame-pointer -funroll-loops
\
      -fpeel-loops -ftracer -finline-functions  execution test
    ...
    but that one has stopped failing at commit c2ebf4f10de "openmp: Add support
    for non-rect simd and improve collapsed simd support".

    The problem is that ftracer duplicates a block containing
GOMP_SIMT_VOTE_ANY.

    That is, before ftracer we have (dropping the GOMP_SIMT_ prefix):
    ...
    bb4(ENTER_ALLOC)
    *----------+
    |           \
    |            \
    |             v
    |             *
    v             bb8
    *<------------*
    bb5(VOTE_ANY)
    *-------------+
    |             |
    |             |
    |             |
    |             |
    |             v
    |             *
    v             bb7(XCHG_IDX)
    *<------------*
    bb6(EXIT)
    ...

    The XCHG_IDX internal-fn does inter-SIMT-lane communication, which for
nvptx
    maps onto shfl, an operator which has the requirement that the warp
executing
    the operator is convergent.  The warp diverges at bb4, and
    reconverges at bb5, and does not diverge by going to bb7, so the shfl is
    indeed executed by a convergent warp.

    After ftracer, we have:
    ...
    bb4(ENTER_ALLOC)
    *----------+
    |           \
    |            \
    |             \
    |              \
    v               v
    *               *
    bb5(VOTE_ANY)   bb8(VOTE_ANY)
    *               *
    |\             /|
    | \  +--------+ |
    |  \/           |
    |  /\           |
    | /  +----------v
    |/              *
    v               bb7(XCHG_IDX)
    *<--------------*
    bb6(EXIT)
    ...

    The warp diverges again at bb5, but does not reconverge again before bb6,
so
    the shfl is executed by a divergent warp, which causes the FAIL.

    Fix this by making ftracer ignore blocks containing ENTER_ALLOC, VOTE_ANY
and
    EXIT, effectively treating the SIMT region conservatively.

    An argument can be made that the test needs to be added in a more
    generic place, like gimple_can_duplicate_bb_p or some such, and that
ftracer
    then needs to use the generic test.  But that's a discussion with a much
    broader scope, so I'm leaving that for another patch.

    Bootstrapped and reg-tested on x86_64-linux.

    Build on x86_64-linux with nvptx accelerator, tested with libgomp.

    gcc/ChangeLog:

            PR fortran/95654
            * tracer.c (ignore_bb_p): Ignore GOMP_SIMT_ENTER_ALLOC,
            GOMP_SIMT_VOTE_ANY and GOMP_SIMT_EXIT.

    libgomp/ChangeLog:

    2020-10-05  Tom de Vries  <tdevries@suse.de>

            PR fortran/95654
            * testsuite/libgomp.fortran/pr95654.f90: New test.

  parent reply	other threads:[~2020-10-05  6:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 11:33 [Bug fortran/95654] New: " tschwinge at gcc dot gnu.org
2020-06-12 14:18 ` [Bug fortran/95654] " tschwinge at gcc dot gnu.org
2020-06-12 15:40 ` burnus at gcc dot gnu.org
2020-09-09 11:27 ` burnus at gcc dot gnu.org
2020-09-15 23:29 ` burnus at gcc dot gnu.org
2020-09-16  7:24 ` burnus at gcc dot gnu.org
2020-09-16 13:23 ` vries at gcc dot gnu.org
2020-09-16 13:33 ` vries at gcc dot gnu.org
2020-09-16 15:54 ` vries at gcc dot gnu.org
2020-09-16 15:57 ` vries at gcc dot gnu.org
2020-09-16 21:11 ` burnus at gcc dot gnu.org
2020-09-17  9:33 ` burnus at gcc dot gnu.org
2020-09-17 10:20 ` vries at gcc dot gnu.org
2020-09-17 13:53 ` vries at gcc dot gnu.org
2020-09-17 15:19 ` vries at gcc dot gnu.org
2020-09-22 17:16 ` cvs-commit at gcc dot gnu.org
2020-09-25  8:55 ` burnus at gcc dot gnu.org
2020-10-05  6:54 ` cvs-commit at gcc dot gnu.org [this message]
2020-10-05  7:01 ` vries at gcc dot gnu.org
2020-10-05  7:01 ` vries 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-95654-4-TEpPPQyHSP@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).