[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 16 09:58:55 PDT 2021


tra added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4442-4446
+      std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false);
+      if (!CPU.empty()) {
+        CmdArgs.push_back("-target-cpu");
+        CmdArgs.push_back(Args.MakeArgString(CPU));
+      }
----------------
This duplicates the same code a bit further down in the function. I think you should just set `-target-cpu` for everyone before diving into `if(embedBitcodeInObject)`.


================
Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature -Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s -o - | FileCheck %s
+// REQUIRES: nvptx-registered-target
----------------
This command line looks extremely odd to me.
If you are compiling with `--cuda-device-only`, then clang should've already set the right triple and the features.

Could you tell me more about what is the intent of the compilation and why you use this particular set of options?
I.e. why not just do `clang -x cuda --offload-arch=sm_70 --cuda-device-only -nocudalib -nocudainc`.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100609



More information about the cfe-commits mailing list