From: Nathan Sidwell <nathan@acm.org>
To: Jakub Jelinek <jakub@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Cesar Philippidis <cesar_philippidis@mentor.com>
Subject: [0/3] OpenACC reductions
Date: Mon, 02 Nov 2015 16:10:00 -0000 [thread overview]
Message-ID: <56378AE9.2020905@acm.org> (raw)
Jakub,
the following patch series implements the reduction handling for OpenACC:
01-trunk-reductions-core-1102.patch Core execution changes
02-trunk-reductions-ptx-1102.patch PTX backend bits
03-trunk-reductions-tests-1102.patch Testcases
The reduction mechanism relies on a new internal builtin -- IFN_GOACC_REDUCTION,
which is used in 4 different places. IYR the loop partionining is managed with
FORK and JOIN unique_fn markers. The reductions go around these as follows:
IFN_UNIQUE (HEAD_MARKER ...)
IFN_REDUCTION (SETUP ...)
IFN_UNIQUE (FORK ...)
IFN_REDUCTION (INIT ...)
IFN_UNIQUE (HEAD_MARKER)
<loop here>
IFN_UNIQUE (TAIL_MARKER ...)
IFN_REDUCTION (FINI ...)
IFN_UNIQUE (JOIN ...)
IFN_REDUCTION (TEARDOWN ...)
IFN_UNIQUE (TAIL_MARKER)
There's a quad of functions for each reduction variable of the loop. If a loop
is partitioned over multiple dimensions, there are additional quads for each
dimension, surrounding the fork/join for that dimension.
All the reduction calls look similar and are:
V = REDUCTION (KIND, REF_TO_RES, LOCAL_VAR, LEVEL, OP, OFFSET)
REF_TO_RES is a pointer to a reciever object. it is a null pointer constant if
there is no such object.
LOCAL_VAR is the executing thread's instance of the reduction variable.
LEVEL is the dimension across which this reduction is partitiong (gang, worker,
vector). As with the head/tail markers,this assignment of level is deferred to
the target compiler.
OP is the reduction operator
OFFSET is an offset into a hypothetical buffer allocated for all the reductions
of this particular loop. It's a way of identifying which quad of reductions
apply to the same logical variable, and happens to be useful in some use cases
(I'll expand on that in the PTX fragment).
All these functions return a new value for the local variable.
When everything collapses to a single thread (i.e. on the host), the
implementation of these functions is trivial.
SETUP
- if REF_TO_RES is not nullptrconst, return *REF_TO_RES, else return
LOCAL_VAR (this is a compile-time check)
INIT & FINI
- return LOCAL_VAR
TEARDOWN
- if REF_TO_RES is not nullptrconst *REF_TO_RES = LOCAL_VAR.
always return LOCAL_VAR
next reply other threads:[~2015-11-02 16:10 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 16:10 Nathan Sidwell [this message]
2015-10-18 23:20 ` [gomp4] fortran testcase Nathan Sidwell
2015-11-02 16:18 ` [1/3] OpenACC reductions Nathan Sidwell
2015-11-03 15:46 ` Jakub Jelinek
2015-11-03 16:02 ` Nathan Sidwell
2015-11-04 10:31 ` Jakub Jelinek
2015-11-04 13:58 ` Nathan Sidwell
2015-11-04 14:08 ` Jakub Jelinek
2015-11-04 9:59 ` Jakub Jelinek
2015-11-06 10:47 ` [gomp4] " Thomas Schwinge
2016-01-07 3:55 ` [gomp4] private reductions Cesar Philippidis
2016-01-07 16:53 ` Cesar Philippidis
2016-01-09 1:14 ` Cesar Philippidis
2016-01-11 12:10 ` Thomas Schwinge
2016-01-11 14:55 ` Cesar Philippidis
2021-08-09 11:37 ` [1/3] OpenACC reductions Thomas Schwinge
2015-11-02 16:35 ` [2/3] " Nathan Sidwell
2015-11-04 10:01 ` Jakub Jelinek
2015-11-04 13:57 ` Nathan Sidwell
2015-11-04 13:27 ` Bernd Schmidt
2015-11-04 14:09 ` Nathan Sidwell
2015-11-04 16:59 ` Nathan Sidwell
2015-11-06 10:48 ` [gomp4] " Thomas Schwinge
2015-11-02 16:38 ` [3/3] " Nathan Sidwell
2015-11-04 10:03 ` Jakub Jelinek
2015-11-06 10:49 ` [gomp4] " Thomas Schwinge
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=56378AE9.2020905@acm.org \
--to=nathan@acm.org \
--cc=cesar_philippidis@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.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).