Set memory access in a loop

I have the following function:

void ikj(float (*a)[N], float (*b)[N], float (*c)[N], int n) {

    int i, j, k;
    float r;

    papi_start();

    for (i = 0; i < n; i++) {
        for (k = 0; k < n; k++) {

            r = a[i][k];

            for (j = 0; j < n; j++)
                c[i][j] += r * b[k][j];

        }
    }

    papi_stop();

}

And I use PAPIto calculate the number of downloads and storages I have between papi_start()and papi_stop(), and the results that I have are the following:

Loads (using PAPI_LD_INS):

32 26781
64 205053
128 1606077
256 12714815
512 101189551
1024 807406950
2048 6450848188

Shops (using PAPI_SR_INS):

32 8290
64 65698
128 524578
256 4194850
512 33555490
1024 268437701
2048 2147487778

where the first value is the size of N, and the second value is the number of instructions.

I am compiling with O3, and the size of my cache is L1 = 32 KB x 2 (instruction and data, 8-way) and L2 = 1024KB (4-way) (common for 2 cores). My Intel T3200 processor and SSE3 ..

, O3 , , , 64 , 16 , , t , - ?

EDIT: , , , , :

http://dl.dropboxusercontent.com/u/878621/mmc.s http://dl.dropboxusercontent.com/u/878621/mmc_asm.s

!

+4
1

, , , N**3 / 4. , O (N ** 3), .

, 4 PAPI_SR_INS. , 16 .

, 3/4 N**3. b c , 2 . , .

, , , .

: , -, , L1, L2 .. - . ? , .

+3

All Articles