This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Bugfix: output file name drops the absolute path where full path is needed.
ClosedPublic

Authored by gtbercea on Sep 15 2017, 11:29 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

gtbercea created this revision.Sep 15 2017, 11:29 AM
tra added a subscriber: tra.Sep 15 2017, 11:41 AM

Shouldn't this temp .cubin file go into the temporary directory, as opposed to the same directory as the input file?

In D37912#872294, @tra wrote:

Shouldn't this temp .cubin file go into the temporary directory, as opposed to the same directory as the input file?

That is indeed the intention. The filename already contains the "/tmp/" I just make sure that doesn't get dropped.

tra added a comment.Sep 15 2017, 12:02 PM
In D37912#872294, @tra wrote:

Shouldn't this temp .cubin file go into the temporary directory, as opposed to the same directory as the input file?

That is indeed the intention. The filename already contains the "/tmp/" I just make sure that doesn't get dropped.

Is that guaranteed to always be the case? If not, you're just hiding the problem.
IMO, it would be better to construct a temporary path for the file, if that's the intention. All you need is TC.getDriver().GetTemporaryPath(...).

gtbercea updated this revision to Diff 115497.Sep 15 2017, 2:32 PM

Fix tests.

hfinkel added inline comments.
lib/Driver/ToolChains/Cuda.cpp
442

Naming this FullPath seems inaccurate. It's not the full path, it's the root path (which is just the root_name + root_directory, but not any directory after that).

In any case, I don't see why all of this is necessary. Can't you just have:

SmallString<256> Name = II.getFilename();
llvm::sys::path::replace_extension(Name, "cubin");

const char *CubinF =
    C.addTempFile(C.getArgs().MakeArgString(Name));
gtbercea updated this revision to Diff 115667.Sep 18 2017, 9:26 AM
gtbercea added a reviewer: hfinkel.
tra added inline comments.Sep 19 2017, 10:26 AM
lib/Driver/ToolChains/Cuda.cpp
441

I don't think explicit StringRef is needed here. SmallString<256> Name(II.getFilename()); should do the job.

gtbercea updated this revision to Diff 115941.Sep 19 2017, 5:55 PM

Address comment.

tra accepted this revision.Sep 20 2017, 9:28 AM
This revision is now accepted and ready to land.Sep 20 2017, 9:28 AM
gtbercea closed this revision.Sep 25 2017, 2:27 PM