[PATCH] D40250: [OpenMP] Consistently use cubin extension for nvlink

Gheorghe-Teodor Bercea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 20 09:01:47 PST 2017


gtbercea added inline comments.


================
Comment at: lib/Driver/ToolChains/Cuda.cpp:431
 
-    SmallString<256> Name(II.getFilename());
-    llvm::sys::path::replace_extension(Name, "cubin");
-
-    const char *CubinF =
-        C.addTempFile(C.getArgs().MakeArgString(Name));
+    const char *CubinF = C.addTempFile(
+        C.getArgs().MakeArgString(getToolChain().getInputFilename(II)));
----------------
Hahnfeld wrote:
> gtbercea wrote:
> > Is this always a cubin?
> Probably because the linker always takes object files...
Considering that the function may also return an object file can you add an assert here that getInputFileName(II) returns a cubin in this case?


================
Comment at: lib/Driver/ToolChains/Cuda.cpp:461
+std::string CudaToolChain::getInputFilename(const InputInfo &Input) const {
+  if (OK != Action::OFK_OpenMP || Input.getType() != types::TY_Object)
+    return ToolChain::getInputFilename(Input);
----------------
Hahnfeld wrote:
> gtbercea wrote:
> > When does this situation occur?
> Well, if that condition fires:
> 1. For CUDA
> 2. For other types. For example, the bundler might need to bundle / unbundle assembly files.
Can you put this info in a comment just before the if statement?


================
Comment at: test/Driver/openmp-offload-gpu.c:51
+// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK-DAG: clang-offload-bundler{{.*}}" "-type=s" {{.*}}"-outputs={{.*}}[[PTX]]
+// CHK-UNBUNDLING-PTXAS-CUBIN-NVLINK: nvlink{{.*}}" {{.*}}"[[CUBIN]]"
 
----------------
This is kind of optional but since the name of the tool contains the word "bundler" and you are performing an unbundling operation, could you also check that the -unbundle flag is passed?


https://reviews.llvm.org/D40250





More information about the cfe-commits mailing list