yxsamliu wrote:

I am afraid this will break all existing CUDA/HIP programs since they expect to 
be able to parse the builtins for both host and device targets.

In the spirit of single source, the compiler sees the entire code for all 
targets, including host target and all device targets. It is supposed to have 
AST for all host and device targets. Ideally, it should generate a 
heterogeneous IR that is for all host and device targets, and eventually 
generate a heterogeneous executable that includes everything. That would make 
some optimizations across host and device IR possible. It is just due to 
current limitation of LLVM/Clang, we generate and process IR separately for 
each host and device target.

I think at least during parsing/sema/AST clang could and should see code and 
AST for both host and device, since that helps avoid inconsistency between host 
and device. Therefore it is necessary to see builtins for both host and device. 
Clang only needs to make sure they are only emitted for the supported target.

https://github.com/llvm/llvm-project/pull/121839
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to