[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 17 08:05:36 PDT 2018


ABataev added a comment.

> Right, warning wasn't a good thought. We really want strict checking and would have to error out when we find a function that wasn't implicitly `declare target` on the host.
>  I meant to ask how common that would be? If that's only some known functions we could handle them separately.

Again, it does not matter how common is this situation. We cannot rely on the probability here, we need to make the compiler to work correctly in all possible situation, no matter how often they can occur.

>>>> The best solution is to use only device specific header files. Device compilation phase should use system header files for the host at all.
>>> 
>>> You mean "shouldn't use system header files for the host"? I think that may be hard to achieve, especially if we want to Sema check all of the source code during device compilation.
>> 
>> Yes, I mean should not. Yes, this is hard to achieve but that's the only complete and correct solution. Everything else looks like a non-stable hack.
> 
> How do you propose to handle inline assembly in non-system header files?

Just like as usual - if the assembler is supported by the device - it is ok, otherwise - error message.


Repository:
  rC Clang

https://reviews.llvm.org/D50845





More information about the cfe-commits mailing list