[cpp-threads] Review comments on N2176 WRT dependency ordering

Peter Dimov pdimov at mmltd.net
Mon Apr 16 16:12:14 BST 2007


Paul E. McKenney wrote:
> Hello again!
>
> I once again thank Hans for his careful description of a number of
> interesting optimization situations relating to dependency-based
> ordering.  The following text discusses some possible approaches
> to resolving these situations.
>
> Thoughts?

[...]

> 8. Allow the optimizer to break dependencies except when explicitly
> told not to.  Potential ways of telling the compiler not to break
> dependencies include:

[...]

N2195 proposes the following minimalistic approach:

template< class T > inline T * atomic_load_address( T * const * p );
template< class T > inline T * atomic_load_address( T * const volatile * 
p );

Returns: *p.

Constraint: _Acquire only with respect to **p.

That is, after X * p = atomic_load_address( &q ), *p is guaranteed to be 
visible, although traversing any additional pointers in *p using ordinary or 
relaxed loads is not well-defined; one needs an additional 
atomic_load_address for them. Index-based dependencies are not supported.

atomic_load_address maps to Relaxed on everything except Alpha, where it 
maps to Acquire.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2195.html




More information about the cpp-threads mailing list