public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [hsa 5/12] New HSA-related GCC options
Date: Fri, 13 Nov 2015 13:01:00 -0000	[thread overview]
Message-ID: <20151113130103.GS2460@virgil.suse.cz> (raw)
In-Reply-To: <20151112111950.GA5675@tucnak.redhat.com>

On Thu, Nov 12, 2015 at 12:19:50PM +0100, Jakub Jelinek wrote:
> On Mon, Nov 09, 2015 at 05:58:56PM +0100, Martin Jambor wrote:
> > > But I don't see any way to disable it on the command line?  (no switch?)
> > 
> > No, the switch is -foffload, which has missing documentation (PR
> > 67300) and is only described at https://gcc.gnu.org/wiki/Offloading
> > Nevertheless, the option allows the user to specify compiler option
> > -foffload=disable and no offloading should happen, not even HSA.  The
> > user can also enumerate just the offload targets they want (and pass
> > them special command line stuff).
> > 
> > It seems I have misplaced a hunk in the patch series.  Nevertheless,
> > in the first patch (with configuration stuff), there is a change to
> > opts.c which scans the -foffload= contents and sets the flag variable
> > if hsa is not present.
> > 
> > Whenever the compiler has to decide whether HSA is enabled for the
> > given compilation or not, it has to look at this variable (if
> > configured for HSA).
> 
> Buut what is the difference between
> -foffload=disable
> or
> -foffload={list not including hsa}
> and the new param?  If you don't gridify, you don't emit any kernels...
> 

We do.  When a kernel cannot be gridified, we try to handle it via
dynamic parallelism (i.e. launching a kernel from a kernel) .  Even
though we have not been able to get any good performance with it and
there are several limitations and open problems, I still include this
option in my plans because it is unlikely we will be able to handle
complex scenarios without it (and I hope that as HSA evolves, it will
become a viable, even though most probably always a bit slower,
option).

Apart from the performance degradation, the biggest problem is that
currently HSA dynamic parallelism does not allow you wait for the
completion of the child kernel in a straightforward way.  There is a
hack that allowed us to do it, but by its nature it only allows depth
three dispatch (i.e. kernel->kernel->kernel).  We are limiting
ourselves to depth two, at the moment.

Dynamic parallelism also requires non-trivial preparation at the CPU
side, and quite a few HSA characteristics of the to-be dispatched
kernels have to be known and passed to the GPU when the first kernel
is invoked.  In our current scheme, we have to know the "dependencies"
of each kernel at compile-time, which is sometimes not possible, for
example if the second kernel is invoked from a function that is in a
different compilation unit than the first kernel.

As I said, I hope that with time we will be able to overcome all of
this, but at the moment, dynamic parallelism is clearly just an
experimental feature (that is why I suggested warning when not
gridifying).

I hope this answers the question and explains the situation a bit,

Martin

  reply	other threads:[~2015-11-13 13:01 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 21:51 Merge of HSA branch Martin Jambor
2015-11-05 21:53 ` [hsa 1/12] Configuration and offloading-related changes Martin Jambor
2015-11-05 22:47   ` Joseph Myers
2015-11-09 16:57     ` Martin Jambor
2015-11-05 21:54 ` [hsa 2/12] Modifications to libgomp proper Martin Jambor
2015-11-12 10:11   ` Jakub Jelinek
2015-11-12 13:22     ` Thomas Schwinge
2015-11-12 14:11       ` Nathan Sidwell
2015-11-12 15:59       ` Jakub Jelinek
2015-11-05 21:56 ` [hsa 3/12] HSA libgomp plugin Martin Jambor
2015-11-05 22:47   ` Joseph Myers
2015-11-09 16:58     ` Martin Jambor
2015-11-05 21:57 ` [hsa 4/12] OpenMP lowering/expansion changes (gridification) Martin Jambor
2015-11-09 10:02   ` Martin Jambor
2015-11-12 11:16   ` Jakub Jelinek
2015-11-05 21:58 ` [hsa 5/12] New HSA-related GCC options Martin Jambor
2015-11-05 22:48   ` Joseph Myers
2015-11-06  8:42   ` Richard Biener
2015-11-09 16:59     ` Martin Jambor
2015-11-10  9:01       ` Richard Biener
2015-11-12 11:19       ` Jakub Jelinek
2015-11-13 13:01         ` Martin Jambor [this message]
2015-11-05 21:59 ` [hsa 6/12] IPA-HSA pass Martin Jambor
2015-11-05 22:01 ` [hsa 7/12] Disabling the vectorizer for GPU kernels/functions Martin Jambor
2015-11-06  8:38   ` Richard Biener
2015-11-10 14:48     ` Martin Jambor
2015-11-10 14:59       ` Richard Biener
2015-11-05 22:02 ` [hsa 8/12] Pass manager changes Martin Jambor
2015-11-05 22:03 ` [hsa 9/12] Small alloc-pool fix Martin Jambor
2015-11-06  9:00   ` Richard Biener
2015-11-06  9:52     ` Martin Liška
2015-11-06  9:57       ` Richard Biener
2015-11-10  8:48         ` Martin Liška
2015-11-10 10:07           ` Richard Biener
2015-11-05 22:05 ` [hsa 10/12] HSAIL BRIG description header file (hopefully not a licensing issue) Martin Jambor
2015-11-06 11:29   ` Bernd Schmidt
2015-11-06 12:45     ` Bernd Schmidt
2015-11-05 22:06 ` [hsa 11/12] Majority of the HSA back-end Martin Jambor
2015-11-05 22:07 ` [hsa 12/12] HSA register allocator Martin Jambor
2015-11-06 10:13 ` Merge of HSA branch Bernd Schmidt
2015-11-06 10:30   ` Richard Biener
2015-11-06 11:03     ` Bernd Schmidt
2015-11-06 11:33       ` Thomas Schwinge
2015-11-06 10:54   ` Martin Liška

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=20151113130103.GS2460@virgil.suse.cz \
    --to=mjambor@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /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).