This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Allow building GCC with PTX offloading even without CUDA being installed (gcc and nvptx-tools patches)
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, Cesar Philippidis <cesar at codesourcery dot com>, Chung-Lin Tang <chunglin_tang at mentor dot com>, Jeff Law <law at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 19 Jan 2017 18:09:35 +0300 (MSK)
- Subject: Re: [PATCH] Allow building GCC with PTX offloading even without CUDA being installed (gcc and nvptx-tools patches)
- Authentication-results: sourceware.org; auth=none
- References: <20170113181123.GA1867@tucnak> <alpine.LNX.2.20.13.1701182237500.21719@monopod.intra.ispras.ru> <20170118221111.GB1867@tucnak>
On Wed, 18 Jan 2017, Jakub Jelinek wrote:
> On Wed, Jan 18, 2017 at 10:52:32PM +0300, Alexander Monakov wrote:
> > Sorry for not noticing this earlier, but ...
> >
> > > +#ifdef __LP64__
> > > +typedef unsigned long long CUdeviceptr;
> > > +#else
> > > +typedef unsigned CUdeviceptr;
> > > +#endif
> >
> > I think this #ifdef doesn't do the right thing on MinGW.
> > Would it be fine to simplify it? In my code I have
> >
> > typedef uintptr_t CUdeviceptr;
>
> I think it depends on if we want to use CUdeviceptr typed variables
> in printf like format strings, or C++ overloading (then the exact
> type is significant and we should go for probably
>
> -#ifdef __LP64__
> +#if defined(__LP64__) || defined(_WIN64)
>
> (is that the right define for 64-bit MingW, right?).
Yes, _WIN64; libsanitizer has a similar test. Alternatively, I guess,
#if __SIZEOF_POINTER__ == 8
> Otherwise, I think using uintptr_t is a problem, because we'd need to
> #include <stdint.h> (the header only includes <stdlib.h>).
Note that plugin-nvptx.c already includes <stdint.h>. But, anyway, I agree that
there's value in defining the exact type via the #if.
Alexander