[llvm-dev] Is it possible to mark llvm.masked.store as volatile or to achieve similar functionality?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 4 13:35:19 PDT 2019

Hi Mike,

On Tue, 4 Jun 2019 at 10:40, Mike Vine (EMUL8R) via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I was thinking of something like adding fences with syncscope of "singlethreaded" to achieve the same things as volatile but I can't work out whether that would work.

Nothing will convert an access to volatile, even ignoring the
properties you mention you don't care about (they're actually not even
guaranteed by volatile). The implementation might still duplicate or
eliminate the stores for example, which would never happen with

But if you're actually trying to enforce ordering (and not with
memory-mapped I/O registers on the host) then volatile is probably the
wrong tool for the job anyway, and fences have a pretty good chance of
being what you should be doing.

But exactly what fences you need will depend on more details of your
use-case. Specifically, on what other resources (CPU/GPU/...) might be
able to see that the operation happened out of order.



More information about the llvm-dev mailing list