ABataev added a comment.

In D99432#2654025 <https://reviews.llvm.org/D99432#2654025>, @jdoerfert wrote:

> In D99432#2653483 <https://reviews.llvm.org/D99432#2653483>, @ABataev wrote:
>
>> In D99432#2653474 <https://reviews.llvm.org/D99432#2653474>, @jdoerfert 
>> wrote:
>>
>>> Can we please always do the globalization, even in the `target teams 
>>> distribute parallel for` case you need it if a thread shares the address of 
>>> a local variable with the team and another thread uses it.
>>
>> Could you give a small example so I could better understand the problem?
>
> I didn't fine my old example, this should do though:
> https://godbolt.org/z/b7axxzxEf
>
> On the host or host offload I see:
> Mine: 0, Other: 42
>
> On a GPU I see:
> CUDA error: Error when synchronizing stream. stream = 0x000000004294db40, 
> async info ptr = 0x00007fffdd939838
> CUDA error: an illegal memory access was encountered
>
>> Shall we globalize the variable in SPMD mode if we pass it by reference/take 
>> address in any case?
>
> Yes. I think that is strictly speaking necessary. We should commit it 
> together with the patches that "undo" globalization though.
>
>>> There is no argument other than "doesn't escape" that Clang can make to 
>>> disprove globalization is needed, IMHO.

It would be better to implement this in a separate patch. Let's fix the bug 
first and then implement the common functionality for locals globalization in 
SPMD mode (probably controlled by the compiler option/flag).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99432

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

Reply via email to