[PATCH] D21723: [RFC] Enhance synchscope representation
Tony Tye via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 31 13:08:41 PDT 2017
t-tye added a comment.
In https://reviews.llvm.org/D21723#769165, @mehdi_amini wrote:
> To expand: my current concern is that the issue spotted with "instance" of scope makes the whole mechanism entirely opaque now, I'm not longer sure what is the point of specifying it at the IR level in a target-independent way.
> @t-tye you were the one mentioning some generic understanding of the code as one of the original motivation IIRC?
I think an important motivation for this change is to be able to express the memory models used in GPU languages such as OpenCL within the LLVM atomics framework. This simplifies how GPU code generators implement support for atomics (for example, https://reviews.llvm.org/D24623 which is based on the earlier version of this patch but can easily be updated for the current version).
It also allows frontends to use the same approach to generate LLVM IR for atomics directly as is currently done for C++. This would allow GPU languages such as OpenCL to do the same (see https://reviews.llvm.org/D28691 which is similarly based on the earlier version but can be updated).
Using a common approach to representing atomics also would make it easier to add support for them to the memory sanitize and optimizations. To do this, suitable TTI queries can be added to provide the information needed as is done for other target specific features.
There have been others (@raunintc, @PFerreira, @sheredom and @rampitec) that have expressed a desire for LLVM to provide memory scope support for GPUs. The proposed approach has no impact on targets that do not require any hardware support for memory scopes, and is backwards compatible with previous LLVM bitcode. The changes suggested by @mehdi_amini have made it much easier to work with at the LLVM textual level.
https://reviews.llvm.org/D21723
More information about the llvm-commits
mailing list