[llvm-dev] Memory scope proposal

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 31 08:23:37 PDT 2016


> On Aug 30, 2016, at 5:53 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> 
> Hi,
> 
> [Sorry for chiming in so late.]
> 
> I understand why a straightforward metadata scheme won't work here,
> but have you considered an alternate scheme that works in the
> following way:
> 
>  - We add a MD node called !nosynch that lists a set of "domains" a
>    certain memory operation does *not* synchronize with.
> 
>  - Memory operations with !nosynch synchronize with memory operations
>    without any !nosynch metadata (so dropping !nosynch is safe).

I’m not sure, but isn’t the synchscope id (or domains as you seem to call it) intended to change which instruction would be actually codegen?
In which case I’m not sure dropping it is ever a good idea, even when it does not affect correctness it would dramatically affect performance.

— 
Mehdi



> 
> This will only work if your frontend knows, ahead of time, what the
> possible set of synch-domains are, but it presumably already knows
> that (otherwise how do you map domain names to integers)?
> 
> The other disadvantage with the scheme above is that memory operations
> on the "normal CPU heap" (pardon my GPU n00b-ness here :) ) will synch
> with the memory operations with !nosynch metadata.  However, we can
> solve that by modeling the "normal CPU heap" as "!nosynch
> !{!special_domain_a, !special_domain_b, ... all domains except
> !cpu_heap_domain}".
> 
> Thanks,
> -- Sanjoy



More information about the llvm-dev mailing list