public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Bernd Schmidt <bernds@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: The nvptx port [0/11+]
Date: Tue, 21 Oct 2014 08:23:00 -0000	[thread overview]
Message-ID: <CAFiYyc1C24cam9GWfNuOMOiaJhdD5Z95O9aXGHi6Zo8apHta2g@mail.gmail.com> (raw)
In-Reply-To: <54451994.9070209@codesourcery.com>

On Mon, Oct 20, 2014 at 4:17 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> This is a patch kit that adds the nvptx port to gcc. It contains preliminary
> patches to add needed functionality, the target files, and one somewhat
> optional patch with additional target tools. There'll be more patch series,
> one for the testsuite, and one to make the offload functionality work with
> this port. Also required are the previous four rtl patches, two of which
> weren't entirely approved yet.
>
> For the moment, I've stripped out all the address space support that got
> bogged down in review by brokenness in our representation of address spaces.
> The ptx address spaces are of course still defined and used inside the
> backend.
>
> Ptx really isn't a usual target - it is a virtual target which is then
> translated by another compiler (ptxas) to the final code that runs on the
> GPU. There are many restrictions, some imposed by the GPU hardware, and some
> by the fact that not everything you'd want can be represented in ptx. Here
> are some of the highlights:
>  * Everything is typed - variables, functions, registers. This can
>    cause problems with K&R style C or anything else that doesn't
>    have a proper type internally.
>  * Declarations are needed, even for undefined variables.
>  * Can't emit initializers referring to their variable's address since
>    you can't write forward declarations for variables.
>  * Variables can be declared only as scalars or arrays, not
>    structures. Initializers must be in the variable's declared type,
>    which requires some code in the backend, and it means that packed
>    pointer values are not representable.
>  * Since it's a virtual target, we skip register allocation - no good
>    can probably come from doing that twice. This means asm statements
>    aren't fixed up and will fail if they use matching constraints.

So with this restriction I wonder why it didn't make sense to go the
HSA "backend" route emitting PTX from a GIMPLE SSA pass.  This
would have avoided the LTO dance as well ...

That is, what is the advantage of expanding to RTL here - what
main benefits do you get from that which you thought would be
different to handle if doing code generation from GIMPLE SSA?

For HSA we even do register allocation (to a fixed virtual register
set), sth simple enough on SSA.  We of course also have to do
instruction selection but luckily virtual ISAs are easy to target.

So were you worried about "duplicating" instruction selection
and or doing it manually instead of with well-known machine
descriptions?

I'm just curious - I am not asking you to rewrite the beast ;)

Thanks,
Richard.

>  * No support for indirect jumps, label values, nonlocal gotos.
>  * No alloca - ptx defines it, but it's not implemented.
>  * No trampolines.
>  * No debugging (at all, for now - we may add line number directives).
>  * Limited C library support - I have a hacked up copy of newlib
>    that provides a reasonable subset.
>  * malloc and free are defined by ptx (these appear to be
>    undocumented), but there isn't a realloc. I have one patch for
>    Fortran to use a malloc/memcpy helper function in cases where we
>    know the old size.
>
> All in all, this is not intended to be used as a C (or any other source
> language) compiler. I've gone through a lot of effort to make it work
> reasonably well, but only in order to get sufficient test coverage from the
> testsuites. The intended use for this is only to build it as an offload
> compiler, and use it through OpenACC by way of lto1. That leaves the
> question of how we should document it - does it need the usual constraint
> and option documentation, given that user's aren't expected to use any of
> it?
>
> A slightly earlier version of the entire patch kit was bootstrapped and
> tested on x86_64-linux. Ok for trunk?
>
>
> Bernd

  parent reply	other threads:[~2014-10-21  8:18 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 14:19 Bernd Schmidt
2014-10-20 14:21 ` The nvptx port [1/11+] indirect jumps Bernd Schmidt
2014-10-21 18:29   ` Jeff Law
2014-10-21 21:03     ` Bernd Schmidt
2014-10-21 21:30       ` Jakub Jelinek
2014-10-21 21:37         ` Bernd Schmidt
2014-10-22  8:21           ` Richard Biener
2014-10-22  8:34             ` Jakub Jelinek
2014-10-22  8:37             ` Thomas Schwinge
2014-10-22 10:03               ` Richard Biener
2014-10-22 10:32                 ` Jakub Jelinek
2014-11-04 15:35   ` Bernd Schmidt
2014-11-04 15:43     ` Richard Henderson
2014-10-20 14:22 ` The nvptx port [2/11+] No register allocation Bernd Schmidt
2014-10-20 14:24 ` Bernd Schmidt
2014-10-21 18:36   ` Jeff Law
2014-10-20 14:24 ` The nvptx port [3/11+] Struct returns Bernd Schmidt
2014-10-21 18:41   ` Jeff Law
2014-10-20 14:27 ` The nvptx port [5/11+] Variable declarations Bernd Schmidt
2014-10-21 18:44   ` Jeff Law
2014-10-20 14:27 ` The nvptx port [4/11+] Post-RA pipeline Bernd Schmidt
2014-10-21 18:42   ` Jeff Law
2024-06-28 15:07   ` Document 'pass_postreload' vs. 'pass_late_compilation' (was: The nvptx port [4/11+] Post-RA pipeline) Thomas Schwinge
2014-10-20 14:31 ` The nvptx port [6/11+] Pseudo call args Bernd Schmidt
2014-10-21 18:56   ` Jeff Law
2014-10-20 14:32 ` The nvptx port [8/11+] Write undefined decls Bernd Schmidt
2014-10-21 22:07   ` Jeff Law
2014-10-21 22:30     ` Bernd Schmidt
2014-10-22 18:23       ` Jeff Law
2014-11-05 12:05         ` Bernd Schmidt
2014-11-05 20:05           ` Jeff Law
2014-10-20 14:32 ` The nvptx port [7/11+] Inform the port about call arguments Bernd Schmidt
2014-10-21 21:25   ` Jeff Law
2014-10-21 21:33     ` Bernd Schmidt
2014-10-21 21:55       ` Jeff Law
2014-10-21 22:16         ` Bernd Schmidt
2014-10-22 18:23           ` Jeff Law
2014-10-28 14:57             ` Bernd Schmidt
2014-10-29 23:42               ` Jeff Law
2014-10-20 14:35 ` The nvptx port [9/11+] Epilogues Bernd Schmidt
2014-10-21 22:08   ` Jeff Law
2014-10-20 14:50 ` The nvptx port [10/11+] Target files Bernd Schmidt
2014-10-22 18:12   ` Jeff Law
2014-10-28 15:10     ` Bernd Schmidt
2014-10-29 23:51       ` Jeff Law
2014-10-30  2:53         ` Bernd Schmidt
2014-10-30  3:09           ` Jeff Law
2014-11-10 16:33         ` Bernd Schmidt
2014-11-10 20:06           ` Jakub Jelinek
2014-11-10 20:37             ` H.J. Lu
2014-11-10 20:40             ` H.J. Lu
2014-11-10 20:42               ` Mike Stump
2014-12-12 20:18           ` Thomas Schwinge
2014-12-23 18:51           ` nvptx-tools and nvptx-newlib (was: The nvptx port [10/11+] Target files) Thomas Schwinge
2015-02-02 15:33             ` Thomas Schwinge
2015-02-04  9:43               ` Jakub Jelinek
2015-02-18  8:50                 ` Thomas Schwinge
2015-02-18  9:03                   ` Jakub Jelinek
2015-07-08 15:03                   ` [nvptx offloading] Only 64-bit configurations are currently supported (was: nvptx-tools and nvptx-newlib) Thomas Schwinge
2015-07-14 20:10                     ` [nvptx offloading] Only 64-bit configurations are currently supported Thomas Schwinge
2015-07-14 20:25                       ` Richard Biener
2021-01-14 18:18                     ` [nvptx libgomp plugin] Build only in supported configurations (was: [nvptx offloading] Only 64-bit configurations are currently supported) Thomas Schwinge
2021-03-04  8:52                       ` [committed] libgomp: Use sizeof(void*) based checks instead of looking through $CC $CFLAGS for -m32/-mx32 Jakub Jelinek
2021-03-22 11:24                         ` Thomas Schwinge
2014-11-04 16:48       ` The nvptx port [10/11+] Target files Richard Henderson
2014-11-04 16:55         ` Bernd Schmidt
2014-11-05 13:07           ` Bernd Schmidt
2014-10-20 14:58 ` The nvptx port [11/11] More tools Bernd Schmidt
2014-10-21  0:16   ` Joseph S. Myers
2014-10-22 20:40   ` Jeff Law
2014-10-22 21:16     ` Bernd Schmidt
2014-10-24 19:52       ` Jeff Law
2014-10-31 21:04   ` Jeff Law
     [not found]     ` <54542050.6010908@codesourcery.com>
2014-11-03 21:49       ` Jeff Law
2014-10-21  8:23 ` Richard Biener [this message]
2014-10-21 10:57   ` The nvptx port [0/11+] Bernd Schmidt
2014-10-21 11:27     ` Richard Biener
2014-10-21  9:17 ` Jakub Jelinek
2014-10-21 11:19   ` Bernd Schmidt
2014-11-12 12:36 ` Richard Biener
2014-11-12 21:39   ` Jeff Law
2015-02-18  7:48 ` nvptx-none: Define empty GOMP_SELF_SPECS (was: The nvptx port [0/11+]) Thomas Schwinge
2015-02-18  8:01 ` The nvptx port [0/11+] 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=CAFiYyc1C24cam9GWfNuOMOiaJhdD5Z95O9aXGHi6Zo8apHta2g@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@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).