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

Steven Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 6 08:42:42 PST 2017


steven_wu added a comment.

In https://reviews.llvm.org/D39502#916409, @jlebar wrote:

> > 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 errors.
>
> You can test this with e.g.
>
>   $ clang -x cuda test.cu -nocudalib -nocudainc --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_60
>
> With this patch, clang prints the errors twice, once for sm_35 and once for sm_60.  Without the patch, it only prints one set of errors, which is the expected behavior.


Ok. I didn't thought about that. To fix that, I guess the driver need to invalidate all the offload input once one compilation failed. Let me see how to do that. Thanks for looking.

> 
> 
>> 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