tra added inline comments.

================
Comment at: lib/Driver/ToolChains/Cuda.cpp:96-105
+      if (llvm::ErrorOr<std::string> ptxas =
+              llvm::sys::findProgramByName("ptxas")) {
+        SmallString<256> ptxasAbsolutePath;
+        llvm::sys::fs::real_path(*ptxas, ptxasAbsolutePath);
+
+        StringRef ptxasDir = llvm::sys::path::parent_path(ptxasAbsolutePath);
+        if (llvm::sys::path::filename(ptxasDir) == "bin")
----------------
Another corner case:
Debian scatters CUDA install all over the filesystem. To make it work with 
clang it has a 'shim' package which re-creates complete CUDA install using 
symlinks to its scattered bits. https://bugs.llvm.org/show_bug.cgi?id=35249.  
If PATH includes such a shim with a symlink pointing to location somewhere else 
in the filesystem, this variant of the patch will not work.

I'd add another candidate derived from the path returned by find. This should 
cover all reasonable scenarios I can think of.

Caveat: clang on Debian already has a special case to add this shim to the list 
of candidates ( D40453 ), so this patch should not affect it. Still, it's 
possible for the similar case to happen somewhere else where we do not have any 
explicit workarounds in clang.

BTW, should this heuristic apply on Windows, too? IIRC cuda installer does add 
CUDA's bin dir to PATH.



https://reviews.llvm.org/D42642



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to