Atomic fences are specified in terms of things that happen when certain atomic reads occur:
- on thread A: first a fence, then some (atomic) store
- on thread B: first an (atomic) load, then a fence
In that particular situation, if the load reads-from the store, then the fences kick in and have an effect. That is the only effect they have, I think.
So, if your program contains no atomic accesses, but some atomic fences, those fences do nothing.
We also think that an atomic fence has at least all the effects of a compiler fence, i.e., a compiler fence is strictly weaker than an atomic fence. But that means a compiler fence has no effect on programs without atomic accesses -- which is just wrong, that's not how they are supposed to behave.
So what is the operational spec of a compiler fence? I have no idea.
See the discussion here for some more details. Let's go on discussing here.
Atomic fences are specified in terms of things that happen when certain atomic reads occur:
In that particular situation, if the load reads-from the store, then the fences kick in and have an effect. That is the only effect they have, I think.
So, if your program contains no atomic accesses, but some atomic fences, those fences do nothing.
We also think that an atomic fence has at least all the effects of a compiler fence, i.e., a compiler fence is strictly weaker than an atomic fence. But that means a compiler fence has no effect on programs without atomic accesses -- which is just wrong, that's not how they are supposed to behave.
So what is the operational spec of a compiler fence? I have no idea.
See the discussion here for some more details. Let's go on discussing here.