[PATCH] D84743: [Clang][AMDGCN] Universal device offloading macros header

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 06:56:14 PDT 2020


jdoerfert added reviewers: tra, MaskRay.
jdoerfert added subscribers: MaskRay, tra.
jdoerfert added a comment.

I like this. I hope this is the start of splitting the `__cuda` headers into generic and specific code, right?  @tra @MaskRay any objections on the direction?



================
Comment at: clang/lib/Headers/offload_macros.h:22
+//===----------------------------------------------------------------------===//
+//===----------------------------------------------------------------------===//
+
----------------
Nit duplicate


================
Comment at: clang/lib/Headers/offload_macros.h:69
+#endif
+#endif
+
----------------
I guess the pattern
```
#if defined(__AMDGCN__)
#define _DEVICE_ARCH amdgcn
// _DEVICE_GPU set below
#endif
#if defined(__NVPTX__)
#define _DEVICE_ARCH nvptx64
#define _DEVICE_GPU __CUDA_ARCH__
#endif
```
is repeating here but it might make sense to lists all the cases one by one instead of a single conditional, e.g., `ifdef OPENMP || SYCL || OPENCL || ...`




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84743/new/

https://reviews.llvm.org/D84743



More information about the cfe-commits mailing list