gochatai/pachi_py/pachi/stats.h
/* There is a write order dependency - when we bump the playouts,
 * our value must be already correct, otherwise the node will receive
 * invalid evaluation if that's made in parallel, esp. when
 * current s->playouts is zero. */
There is a write order dependency - when we bump the playouts,
our value must be already correct, otherwise the node will receive
invalid evaluation if that's made in parallel, esp. when
current s->playouts is zero.
There is a write order dependency - when we bump the playouts our value must be already correct otherwise the node will receive invalid evaluation if that ' s made in parallel esp . when current s - > playouts is zero .
static inline void
stats_add_result(struct move_stats *s, floating_t result, int playouts)
{
	int s_playouts = s->playouts;
	floating_t s_value = s->value;
	__sync_synchronize(); 
	s_playouts += playouts;
	s_value += (result - s_value) * playouts / s_playouts;
	s->value = s_value;
	__sync_synchronize(); 
	s->playouts = s_playouts;
}
static inline void stats_add_result ( struct move_stats * s , floating_t result , int playouts ) { int s_playouts = s -> playouts ; floating_t s_value = s -> value ; __sync_synchronize ( ) ; s_playouts += playouts ; s_value += ( result - s_value ) * playouts / s_playouts ; s -> value = s_value ; __sync_synchronize ( ) ; s -> playouts = s_playouts ; }
There is a write order dependency - when we bump the playouts,
 our value must be already correct, otherwise the node will receive
 invalid evaluation if that's made in parallel, esp.
There is a write order dependency - when we bump the playouts our value must be already correct otherwise the node will receive invalid evaluation if that ' s made in parallel esp .
/* Force the load, another thread can work on the
	 * values in parallel. */ /* full memory barrier */ /* We rely on the fact that these two assignments are atomic. */ /* full memory barrier */