Date: Thu, 11 Jun 2026 18:02:22 -0700
On Thursday, 11 June 2026 16:34:14 Pacific Daylight Time Simon Cooke wrote:
> There is no requirement that an acquire barrier be preceded by a release
> barrier. All an acquire barrier means is "ensure that no read operation
> after this instruction can be reordered before this instruction".
> Similarly, a release barrier means "ensure that all pending write
> operations are completed before passing beyond this instruction".
I understand that. That would mean the time-ticking thread could do a relaxed
store.
Do note that an acquire fence is more than what you said. It must prevent both
read and write operations younger than the barrier from completing before the
barrier does. This means that if the clock read has an acquire fence, then a
store operation after that call in program order will become visible only
after the clock read has completed.
Obviously, if the value we store depends on the clock, then the happens-before
is clear: one can't store a value without first having loaded said value.
But revising my thinking: I think I now agree with Jennifer that the clock
operation must be acq_rel.
> There is no requirement that an acquire barrier be preceded by a release
> barrier. All an acquire barrier means is "ensure that no read operation
> after this instruction can be reordered before this instruction".
> Similarly, a release barrier means "ensure that all pending write
> operations are completed before passing beyond this instruction".
I understand that. That would mean the time-ticking thread could do a relaxed
store.
Do note that an acquire fence is more than what you said. It must prevent both
read and write operations younger than the barrier from completing before the
barrier does. This means that if the clock read has an acquire fence, then a
store operation after that call in program order will become visible only
after the clock read has completed.
Obviously, if the value we store depends on the clock, then the happens-before
is clear: one can't store a value without first having loaded said value.
But revising my thinking: I think I now agree with Jennifer that the clock
operation must be acq_rel.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-06-12 01:02:33
