1
1

Work around what appears to be an odd error in the pathscale compiler where

the dispatch function opal_atomic_cmpset_acq_xx was used to call
opal_atomic_cmpset_acq_32  would cause the compiler / linker to fix up a
jump address to be itself, leading to an infinite loop.

We're still looking into exactly what caused this, but during the
investigation into the hang, we determined that the compiler (both pathcc
and gcc) weren't always inlining both the call to opal_atomic_cmpset_acq_xx
and opal_atomic_cmpset_acq_32, meaning there was a function call in
opal_atomic_lock.  The atomic lock will always be 32 bit, so there's no
need for the dispatch function, so might as well remove the dispatch
function that may or may not be inlined.

A bug fix that leads to potentially better performance.  Gotta love the
few times that happens...

This commit was SVN r13651.
Этот коммит содержится в:
Brian Barrett 2007-02-14 16:57:39 +00:00
родитель beb9be3fe4
Коммит 4890636581
2 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -101,7 +101,7 @@ extern "C" {
*/
struct opal_atomic_lock_t {
union {
volatile int lock; /**< The lock address (an integer) */
volatile int32_t lock; /**< The lock address (an integer) */
volatile unsigned char sparc_lock; /**< The lock address on sparc */
char padding[sizeof(int)]; /**< Array for optional padding */
} u;

Просмотреть файл

@ -334,7 +334,7 @@ static inline int32_t opal_atomic_sub_ptr( volatile void* addr,
* Lock initialization function. It set the lock to UNLOCKED.
*/
static inline void
opal_atomic_init( opal_atomic_lock_t* lock, int value )
opal_atomic_init( opal_atomic_lock_t* lock, int32_t value )
{
lock->u.lock = value;
}
@ -343,7 +343,7 @@ opal_atomic_init( opal_atomic_lock_t* lock, int value )
static inline int
opal_atomic_trylock(opal_atomic_lock_t *lock)
{
return opal_atomic_cmpset_acq( &(lock->u.lock),
return opal_atomic_cmpset_acq_32( &(lock->u.lock),
OPAL_ATOMIC_UNLOCKED, OPAL_ATOMIC_LOCKED);
}
@ -351,7 +351,7 @@ opal_atomic_trylock(opal_atomic_lock_t *lock)
static inline void
opal_atomic_lock(opal_atomic_lock_t *lock)
{
while( !opal_atomic_cmpset_acq( &(lock->u.lock),
while( !opal_atomic_cmpset_acq_32( &(lock->u.lock),
OPAL_ATOMIC_UNLOCKED, OPAL_ATOMIC_LOCKED) ) {
while (lock->u.lock == OPAL_ATOMIC_LOCKED) {
/* spin */ ;