[PATCH] D23042: [CUDA] Do not allow using NVPTX target for host compilation.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 17:41:26 PDT 2016

tra added inline comments.

Comment at: lib/Driver/ToolChains.cpp:4834
@@ -4831,2 +4833,3 @@
+    getDriver().Diag(diag::err_drv_cuda_nvptx_host);
   return DAL;
jlebar wrote:
> IRL we talked about putting an assert() here and bailing out earlier.  Does that not work?
> My hope was that we could avoid having to put checks everywhere that the -arch flag is non-empty.
> Also, if we're going to print an error message saying "you can't use nvptx as the host compiler", it would be nice to do that at some point in the code where we have confidence that someone is actually trying to use nvptx as the host compiler, instead of assuming that, if we get here, that's what happened.
Haven't found a good place for it yet.
Another problem is that Driver::Diag() does not abort the program and we'll continue on and will execute these functions and will trigger asserts if they are there. I'll try changing diagnostics from Error to Fatal. If that stops clang right there, then we can keep asserts in place.


More information about the cfe-commits mailing list