Dear list,

The problem is that I do not see memory contention in gem5 :( ... let me
explain

I write two simple C++ codes:
- work: which accesses memory very frequently and each access produces a L1
and L2 miss
- sleep: which is a simple busy wait.
[Source codes bellow]

I run two very simple experiences in X86 SE + Ruby (MOESI_CMP_token). 2
CPUs, 256kB L2 8-way set associative.
- Exp1: The above system run two instances of work.
- Exp2: The above system run one instance of work and one instance of sleep

Since almost
- every memory request in work misses
 and
- every memory request of sleep hits in L1

==> memory becomes bottle neck for two CPUs and

I expect:
runtime of work+work ~= 2x runtime of work+sleep

But, this is not what I got ... and I don't know why!

runtime of work+work = 0.015932
runtime of work+sleep = 0.015906
The above numbers are sim_seconds of stats.txt

any idea on this?

Source code of work:
-----------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <time.h>
#include <stdlib.h>

using namespace std;

#define SIZE 1*1024*1024
#define SET SIZE/8
#define BLOCK 64/sizeof(short)
#define ITERATION 4


int main(int argc, char** argv)
{
        volatile short dummy[SIZE];

        for(long it=0; it<ITERATION; it++)
        {
                volatile int x;
                for(int j=0; j<SET; j+= BLOCK )
                        for(int i=j; i<SIZE; i+= SET)
                                x ^= dummy [i];
        }
        return 0;
}

-----------------------------------------------------------------------------------------------------------------------------------
Source code of sleep:
-----------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <time.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char** argv)
{

        while(1)
        {
                volatile int x, y;
                x ^= y;
        }
        return 0;
}

-----------------------------------------------------------------------------------------------------------------------------------
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to