public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Cesar Philippidis <cesar@codesourcery.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,
	Thomas Schwinge <thomas@codesourcery.com>
Subject: Re: [patch] adjust default nvptx launch geometry for OpenACC offloaded regions
Date: Mon, 02 Jul 2018 14:14:00 -0000	[thread overview]
Message-ID: <130dc2ce-1db1-1fdd-a4a3-63e479466beb@suse.de> (raw)
In-Reply-To: <0034e0fb-402e-8681-0f62-3fd274d00a99@codesourcery.com>

On 06/21/2018 03:58 PM, Cesar Philippidis wrote:
> On 06/20/2018 03:15 PM, Tom de Vries wrote:
>> On 06/20/2018 11:59 PM, Cesar Philippidis wrote:
>>> Now it follows the formula contained in
>>> the "CUDA Occupancy Calculator" spreadsheet that's distributed with CUDA.
>>
>> Any reason we're not using the cuda runtime functions to get the
>> occupancy (see PR85590 - [nvptx, libgomp, openacc] Use cuda runtime fns
>> to determine launch configuration in nvptx ) ?
> 
> There are two reasons:
> 
>   1) cuda_occupancy.h depends on the CUDA runtime to extract the device
>      properties instead of the CUDA driver API. However, we can always
>      teach libgomp how to populate the cudaDeviceProp struct using the
>      driver API.
> 
>   2) CUDA is not always present on the build host, and that's why
>      libgomp maintains its own cuda.h. So at the very least, this
>      functionality would be good to have in libgomp as a fallback
>      implementation;

Libgomp maintains its own cuda.h to "allow building GCC with PTX
offloading even without CUDA being installed" (
https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00980.html ).

The libgomp nvptx plugin however uses the cuda driver API to launch
kernels etc, so we can assume that's always available at launch time.
And according to the "CUDA Pro Tip: Occupancy API Simplifies Launch
Configuration", the occupancy API is also available in the driver API.

What we cannot assume to be available is the occupancy API pre cuda-6.5.
So it's fine to have a fallback for that (properly isolated in utility
functions), but for cuda 6.5 and up we want to use the occupancy API.

>      its not good to have program fail due to
>      insufficient hardware resources errors when it is avoidable.
>

Right, in fact there are two separate things you're trying to address
here: launch failure and occupancy heuristic, so split the patch.

Thanks,
- Tom

  reply	other threads:[~2018-07-02 14:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 21:59 Cesar Philippidis
2018-06-20 22:16 ` Tom de Vries
2018-06-21 13:58   ` Cesar Philippidis
2018-07-02 14:14     ` Tom de Vries [this message]
2018-07-02 14:39       ` Cesar Philippidis
2018-07-11 19:13       ` Cesar Philippidis
2018-07-26 11:58         ` Tom de Vries
2018-07-26 12:13         ` [libgomp, nvptx] Move device property sampling from nvptx_exec to nvptx_open Tom de Vries
2018-07-26 12:45         ` [patch] adjust default nvptx launch geometry for OpenACC offloaded regions Tom de Vries
2018-07-26 14:27         ` Cesar Philippidis
2018-07-26 15:18           ` Tom de Vries
2018-07-30 10:16         ` Tom de Vries
2018-06-29 17:16 ` Cesar Philippidis
2018-06-30 11:36   ` Cesar Philippidis

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=130dc2ce-1db1-1fdd-a4a3-63e479466beb@suse.de \
    --to=tdevries@suse.de \
    --cc=cesar@codesourcery.com \
    --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).