This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Driver changes to support CUDA compilation on Windows.
ClosedPublic

Authored by jlebar on Jan 4 2017, 1:57 PM.

Details

Summary

For the most part this is straightforward: Just add a CudaInstallation
object to the MSVC and MinGW toolchains.

CudaToolChain has to override computeMSVCVersion so that
Clang::constructJob passes the right version flag to cc1. We have to
modify IsWindowsMSVC and friends in Clang::constructJob to be true when
compiling CUDA device code on Windows for the same reason.

Depends on: D28319

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 83127.Jan 4 2017, 1:57 PM
jlebar retitled this revision from to [Driver] Driver changes to support CUDA compilation on Windows..
jlebar updated this object.
jlebar added a reviewer: tra.
jlebar added a subscriber: cfe-commits.
tra accepted this revision.Jan 4 2017, 4:56 PM
tra edited edge metadata.
tra added inline comments.
clang/lib/Driver/ToolChains.cpp
1819 ↗(On Diff #83127)

I'd keep unix-like paths as defaults under else {}.
If you do want to enumerate supported OS variants explicitly, then me want to throw an error if particular host OS is not supported.

This revision is now accepted and ready to land.Jan 4 2017, 4:56 PM
jlebar marked an inline comment as done.Jan 4 2017, 5:20 PM

Thank you for the reviews!

clang/lib/Driver/ToolChains.cpp
1819 ↗(On Diff #83127)

Sure, done locally, will be reflected when I commit.

This revision was automatically updated to reflect the committed changes.
jlebar marked an inline comment as done.
chapuni added a subscriber: chapuni.Jan 6 2017, 2:26 AM

It fails with LLVM_DEFAULT_TARGET_TRIPLE=i686-pc-win32, on linux.
http://bb.pgr.jp/builders/ninja-x64-msvc-RA-centos6/builds/33445
Seems it assumes Windows' layout even if the host is not Windows.

128838 stat64("/path/to/llvm-project/clang/test/Driver/Inputs/CUDA/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0", 0xffc9bdc0) = -1 ENOENT (No such file or directory)

If you wouldn't consider such a configuration, I could add exclusion to lit.cfg.

rnk added a subscriber: rnk.Jan 6 2017, 10:27 AM

I went ahead and landed rL291255 to try to fix forward. Take a look and let me know if that's not the right fix.