Re: [Gems-users] LogTM Transactions Hanging (Gems 2.1)


Date: Wed, 18 Jun 2008 22:01:16 -0400 (EDT)
From: Daniel Nussbaum - Sun Microsystems - Burlington United States <dan.nussbaum@xxxxxxx>
Subject: Re: [Gems-users] LogTM Transactions Hanging (Gems 2.1)
> 
> Date: Thu, 19 Jun 2008 10:43:44 +1200
> From: Fuad Tabba <fuad@xxxxxxxxxxxxxxxxx>
> 
> Thanks for the binary Jayaram.
> 
> deque_TM is working fine with BASE and TIMESTAMP conflict resolution.
> So I guess this means that the problem is in my binaries/benchmarks
> and not in my simulation environment.
> 
> I'm using sun c compiler (5.9) with the flags -xO3 -m32
> -xarch=sparcvis among others.
> 
> I also had to rewrite some of the __asm__ macros since the sun c
> compiler doesn't seem to handle them well if they have parameters (I
> did this for the old gems 1.2 as well). This is what I did:-
>

Our version of magic-instruction.h (included below) shows how we
generate magic instructions.  It's easy enough to add versions for the
other various magic instructions you'll want.

I suspect you'll want to inline this way, since at least with older
versions of some compilers, using asm() inlining causes most other
optimizations to be turned off in the entire enclosing function.

dann

----------------------
[magic-instruction.h]
-----------
/*
 * magic-instruction.h
 */

#ifndef   _SIMICS_SIMICS_MAGIC_INSTRUCTION_H

#define   _SIMICS_SIMICS_MAGIC_INSTRUCTION_H


#define __MAGIC_CASSERT(p) do {                     \
  typedef int __check_magic_argument[(p) ? 1 : -1]; \
} while (0)

#define MAGIC(n) do {                               \
  __MAGIC_CASSERT((n) > 0 && (n) < (1U << 22));     \
  asm ("sethi " #n ", %g0");                        \
} while (0)

#define MAGIC_BREAKPOINT MAGIC(0x40000)


//
//  Signal a breakpoint.
//
inline void
ruby_breakpoint()
{
  // With Ruby/LogTM, this is how you get a breakpoint.
  //
  MAGIC(0x40000);
}

//
// Tell simics we've started a unit of work.
//
inline void
ruby_begin_unit()
{
  // With Ruby/LogTM, this is how you signify completion of a "unit of
  // work".
  //
  MAGIC(0x30000);
}

//
// Tell simics we've finished a unit of work.
//
inline void
ruby_finish_unit()
{
  // With Ruby/LogTM, this is how you signify completion of a "unit of
  // work".
  //
  MAGIC(0x50000);
}

//
// Dump registers to simulator console.
//
inline void
ruby_dump_registers()
{
  MAGIC(100);
}


#endif /* _SIMICS_SIMICS_MAGIC_INSTRUCTION_H */
[← Prev in Thread] Current Thread [Next in Thread→]