[Openmp-dev] OpenMP defines __CUDA_ARCH__ for offloading, should it?

Jon Chesterfield via Openmp-dev openmp-dev at lists.llvm.org
Wed Jul 22 10:28:15 PDT 2020


Thanks guys

Defining CUDA_ARCH on non-nvptx architectures is definitely bad. I think
Ron has a test case that used CUDA_ARCH to test for running on nvptx. I'm
trying to stop amdgcn defining it for openmp at present.

> I would suggest we keep __CUDA_ARCH__ and introduce __AMDGCN_ARCH__ as
needed.

That sounds better, with the proviso that nvptx shouldn't define
AMDGCN_ARCH and amdgcn shouldn't define CUDA_ARCH.

We kind of conflate cuda and nvptx. Perhaps the macro should be NVTPX_ARCH
instead of CUDA_ARCH?

There may be no problem here. Defining CUDA macros for openmp seemed weird,
but I've since learned that cuda intrinsics work within openmp target
regions for nvptx and that seems useful.

Thanks,

Jon


On Wed, Jul 22, 2020 at 6:19 PM Johannes Doerfert <
johannesdoerfert at gmail.com> wrote:

>
> On 7/22/20 12:15 PM, Hal Finkel via Openmp-dev wrote:
> >
> > On 7/22/20 11:34 AM, Jon Chesterfield via Openmp-dev wrote:
> >> Discovered by accident while looking into a bug for Ron (cc'd).
> >>
> >> OpenMP running on nvptx defines the __CUDA_ARCH__ macro. Do we think
> >> it should? OpenMP target offloading is somewhat implemented in terms
> >> of cuda but that seems incidental.
> >
> >
> > Shouldn't it do this only when compiling device code for NVIDIA
> > architectures?
> >
> Yes, I implicitly assumed that given that we only compile for NVIDIA
> right now.
>
> FWIW, I don't assume __CUDA_ARCH__ to be present for non-NVIDIA targets.
>
>
>
> >  -Hal
> >
> >
> >>
> >> I'd like a __GPU_ARCH__ macro which expands to something useful for
> >> nvptx, amdgcn, other. And to not define CUDA_ARCH when compiling
> >> openmp offloading code.
> >>
> >> Thoughts?
> >>
> >> Jon
> >>
> >> _______________________________________________
> >> Openmp-dev mailing list
> >> Openmp-dev at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
> >
> >
> > _______________________________________________
> > Openmp-dev mailing list
> > Openmp-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20200722/19495a38/attachment-0001.html>


More information about the Openmp-dev mailing list