[PATCH] D146975: [NVPTX] Add __CUDA_ARCH__ macro to standalone NVPTX compilations

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 10:22:12 PDT 2023


tra accepted this revision.
tra added inline comments.


================
Comment at: clang/lib/Basic/Targets/NVPTX.cpp:171
   Builder.defineMacro("__NVPTX__");
-  if (Opts.CUDAIsDevice || Opts.OpenMPIsDevice) {
+  if (Opts.CUDAIsDevice || Opts.OpenMPIsDevice || !HostTarget) {
     // Set __CUDA_ARCH__ for the GPU specified.
----------------
Wouldn't just `if(!HostTarget)` be sufficient here?



================
Comment at: clang/test/Frontend/nvptx-macros.c:1
+// REQUIRES: nvptx-registered-target
+
----------------
I'd rename the file to make it more obvious that it deals with a standalone compilation.

`standalone-nvptx-macros.c` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146975



More information about the cfe-commits mailing list