[PATCH] D38883: [CMake][OpenMP] Customize default offloading arch

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 13 09:29:19 PDT 2017

tra added inline comments.

Comment at: lib/Driver/ToolChains/Cuda.cpp:170-182
-    // This code prevents IsValid from being set when
-    // no libdevice has been found.
-    bool allEmpty = true;
-    std::string LibDeviceFile;
-    for (auto key : LibDeviceMap.keys()) {
-      LibDeviceFile = LibDeviceMap.lookup(key);
-      if (!LibDeviceFile.empty())
I'd keep this code. It appears to serve useful purpose as it requires CUDA installation to have at least some libdevice library in it.  It gives us a change to find a valid installation, instead of ailing some time later when we ask for a libdevice file and fail because there are none.

Comment at: lib/Driver/ToolChains/Cuda.cpp:556
+      DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ),
+                        CLANG_OPENMP_NVPTX_DEFAULT_ARCH);
This sets default GPU arch for *everyone* based on OPENMP requirements. Perhaps this should be predicated on this being openmp compilation.

IMO to avoid unnecessary surprises, the default for CUDA compilation should follow defaults of nvcc. sm_30 becomes default only in CUDA-9.


More information about the cfe-commits mailing list