I am working with TMDSEVM6678L. I counted the cycle number of 512 samples convolution. And I compared with using DDR3 and SHRAM on data/code memory section.
I expected that the cycle number of using SHRAM is lower than using DDR3.
But the number of cycles is as follows.
[Memory Sections]
data memory:SHRAM
code memory:SHRAM
stack memory:L2SRAM
⇒5282154 cycles
[Memory Sections]
data memory:DDR3
code memory:DDR3
stack memory:L2SRAM
⇒3324412 cycles
Why is this result occured? And please teach me how to reduction of cycles when using SHRAM.
The code is as follows.(The base project is omp_1_02_00_05\packages\ti\omp\examples(omp_matvec.c))
-------------------------------------------------------------------------------------------------------
#include <ti/omp/omp.h>
#include <stdio.h>
#include <math.h>
#include <ti/csl/soc.h>
#include <ti/csl/csl.h>
#include <ti/csl/csl_cache.h>
#include <ti/csl/csl_cacheAux.h>
#define NTHREADS 8
#define N (512)
#define M (16)
#define L (4)
#define SAMPLE (64)
double x[L][M][N], y[L][M][N];
void main()
{
CACHE_setL1DSize(CACHE_L1_32KCACHE);
CACHE_setL1PSize(CACHE_L1_32KCACHE);
CACHE_setL2Size(CACHE_256KCACHE);
int L1Dsize = CACHE_getL1DSize();
int L1Psize = CACHE_getL1PSize();
int L2size = CACHE_getL2Size();
printf("L1Dsize = %d \n", L1Dsize);
printf("L1Psize = %d \n", L1Psize);
printf("L2size = %d \n", L2size);
CACHE_enableCaching(16);
CACHE_enableCaching(17);
CACHE_enableCaching(18);
CACHE_enableCaching(19);
CACHE_enableCaching(20);
CACHE_enableCaching(21);
CACHE_enableCaching(22);
CACHE_enableCaching(23);
int i, j, k, n, nthread;
CSL_Uint64 start, end;
start = getcycles( );
for(n=0; n<SAMPLE; n++)
{
for(j=0; j<M; j++)
{
for(k=0; k<L; k++)
{
double temp = 0.0;
for(i=0; i<N; i++ )
{
temp += x[k][j][i]*y[k][j][i];
}
}
}
}
end = getcycles( );
printf("Elapsed time(1 core ) =\t%lld\tcycles\n", (end-start) );
}
void wcycles(unsigned long long *c)
{
static int first = 1;
if (first)
{
CSL_tscEnable();
first = 0;
}
*c = CSL_tscRead();
}
unsigned long long getcycles()
{
unsigned long long cycles;
wcycles(&cycles);
return cycles;
}
-------------------------------------------------------------------------------------------------------
My development environment is follows.
・CCS v5.2.1
・MCSDK(2.1.2.6)
・OpenMP(1.2.0.5)
Many thanks.