yaxunl added a comment.

In D144047#4129182 <https://reviews.llvm.org/D144047#4129182>, @shangwuyao 
wrote:

> In D144047#4129154 <https://reviews.llvm.org/D144047#4129154>, @yaxunl wrote:
>
>> Making the builtin types consistent is necessary to keep struct layout 
>> consistent across host and device, but why do we need to make  
>> __GCC_ATOMIC_XXX_LOCK_FREE macros the same between the host and device? Is 
>> there any concrete issue if they are not the same?
>
> The reason is the same as NVPTX, see 
> https://github.com/llvm/llvm-project/blob/22882c39df71397cc6f9774d18e87d06e016c55f/clang/lib/Basic/Targets/NVPTX.cpp#L137-L141.
>  Without it, we won't be able to use libraries that statically check the 
> __atomic_always_lock_free. I could add the comments in the code if that makes 
> things more clear.

I see. Better add some comments about that.

This also means backend needs to handle atomic operations not supported by 
hardware.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144047/new/

https://reviews.llvm.org/D144047

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to