[PATCH] D39502: [Driver] Make clang/cc conforms to UNIX standard

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 5 20:16:22 PST 2017


jlebar requested changes to this revision.
jlebar added a comment.
This revision now requires changes to proceed.

> Note the host clang side has the inputs "test.cu" and "test-c3378c.fatbin". Which means if the device side compilation failed, the host side will not compile because InputOk will return false in this case

The patch handles this case correctly, thank you.

Unfortunately it's a bit more complicated than this.  You can pass `--cuda-gpu-arch=XXX` multiple times when invoking clang, and that will result in multiple compilations for different GPU architectures.  In this case we want to fail when the first one fails, on the theory that (most of the time) all compilations will have the same error.

You can test this with e.g.

  $ clang -x cuda test.cu -nocudalib -nocudainc --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60

In the testcase above, this outputs the errors twice, once for sm_35 and once for sm_60.

> I don't know what is the best way to write test cases for CUDA driver.

Thanks for offering to write tests for this.  See `ls clang/test/Driver | grep '\.cu$'`, and let me know if you need help crafting a testcase.


https://reviews.llvm.org/D39502





More information about the cfe-commits mailing list