jeanPerier wrote:

> Exceptions are unconditionally disabled in `cmake/modules/AddFlangRT.cmake`: 
> https://github.com/llvm/llvm-project/pull/110217/files#diff-be23c742c88da2fe1ce8d045ad3e39bed2c26ee02ffadcb4c04db40a4857cb55R70

Ah, this only changes for the CUDA build then (using  
`-DFLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA` and 
`-DFLANG_RT_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS=ON`).

With the new build, I am not seeing those flags passed to NVCC when compiling 
runtime with CUDA (I cannot see them using make VERBOSE=1). With LLVM mechanism 
from [AddLLVM, these flags are added based on the source extension, not the 
cmake 
language](https://github.com/llvm/llvm-project/blob/bf483ddb42065405e345393e022dc72357ec5a3a/llvm/cmake/modules/AddLLVM.cmake#L77-L96).

I think it is because COMPILE_LANGUAGE:CXX does not work for sources where the 
language has been set to CUDA. Since CUDA may be C or C++ sources, it would 
also be wrong to add them to COMPILE_LANGUAGE:CUDA.

I do not think cmake has a way to specify flags to be passed to host compilers 
([from this cmake 
issue](https://gitlab.kitware.com/cmake/cmake/-/issues/25911)). 

Maybe you could define those flags in some functions that could be used both 
here to set COMPILE_LANGUAGE:CXX flags and in `AddFlangRTOffload` to add these 
flags to the `CUDA_COMPILE_OPTIONS`.

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

Reply via email to