[PATCH] D12917: [CUDA] Allow parsing of host and device code simultaneously.
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 17 10:44:47 PDT 2015
tra marked an inline comment as done.
tra added a comment.
In http://reviews.llvm.org/D12917#247868, @jpienaar wrote:
> Nice, so this will allow parsing/AST construction with builtins from 2 architectures but will fail to compile if a builtin for the host/device is called from device/host.
It CUDA target call checks are in effect, we'll get a usual error that H->D or D->H call is illegal. If we're compiling with -fcuda-disable-target-call-checks, then we'll fail during codegen phase complaining that builtin has not been implemented.
> You mention this is not generally possible. Can you give some examples?
It's mostly related to mixing include files and preprocessor macros from multiple targets.
If an include is written to conditionally provide mutually exclusive constructs for targets A and B, then compiling for A with -aux-triple B will produce something uncompilable. For instance following include will fail due to redefinition of foo() if compiled with -triple x86_64 -aux-triple nvptx64
#ifdef __amd64__
int foo() {return 1;}
#endif
#ifdef __PTX__
int foo() {return 2;}
#endif
================
Comment at: include/clang/Driver/CC1Options.td:329
@@ -328,1 +328,3 @@
+def aux_triple : Separate<["-"], "aux-triple">,
+ HelpText<"Auxiliary triple.">;
def code_completion_at : Separate<["-"], "code-completion-at">,
----------------
jpienaar wrote:
> You use aux target in all the errors to the user so perhaps for consistency "Triple for aux target". It could be more self-documenting too ("Triple for aux target used during CUDA compilation."?) as I don't know if a lot of people would be able to guess what the auxiliary triple is or where it is used.
Changed to "Auxiliary target triple." While CUDA uses the aux target triple for preprocessor macros and builtins, nothing stops anyone else using this information for other purposes, so I kept the name and the comment generic.
http://reviews.llvm.org/D12917
More information about the cfe-commits
mailing list