shangwuyao added a comment. In D144047#4129247 <https://reviews.llvm.org/D144047#4129247>, @yaxunl wrote:
> 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. Yeah. It is probably the application developer's responsibility to not request atomics that are not supported by the 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 [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits