This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • TI Thinks Resolved

Linux/TDA2EX17EVM: Write data performance exception on l2

Prodigy 60 points

Replies: 3

Views: 236

Part Number: TDA2EX17EVM

Tool/software: Linux

In our project, the performance consumption is mainly on writing data, and it is found that the writing speed of l2 is very slow. Moreover, we did a simple test, writing data to a fixed address of l2 and continuously writing the same amount of data on a certain size of l2 block, the performance is quite different.Is that normal? Any good guidance?(our test code is shown below.)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <c6x.h>
#define N_BYTEALIGN8 8
extern int Vps_printf(const char *format, ...);
typedef struct
{
unsigned char *pMem;
int nMemLen;
}TI_MEM;

void *TI_GetMem8(TI_MEM *pMemory, int nLen)
{
int nByteAlign = N_BYTEALIGN8;
void* pRet;
pMemory->nMemLen -= ((nByteAlign - ((unsigned int)(pMemory->pMem) & (nByteAlign - 1))) &(nByteAlign - 1));
pMemory->pMem += ((nByteAlign - ((unsigned int)(pMemory->pMem) & (nByteAlign - 1))) &(nByteAlign - 1));
pRet = pMemory->pMem;
pMemory->pMem += nLen;
pMemory->nMemLen -= nLen;
return pRet;
}

int ArcNEATEng_Test(unsigned char* pMemL2) {
int ret = 0;
int i, j, k;
TI_MEM L2TMP;
L2TMP.pMem = pMemL2;
L2TMP.nMemLen = 200 * 1024;

if (L2TMP.nMemLen < 0)
{
Vps_printf("ArcNEATEng_Forward memory, required is provided\n");
return;
}
unsigned char *pInputBufL2 = (unsigned char*)TI_GetMem8(&L2TMP, sizeof(unsigned char)* 100 * 1024);

{
unsigned long long WH_time[10];
double WH_cost[10];
TSCH = 0;
TSCL = 0;
WH_time[0] = _itoll(TSCH, TSCL);

for(i = 0; i < 1024; ++i)
{
unsigned char *pInputL2 = pInputBufL2;
for(j = 0;j < 100*1024; j += 8)
{
int out1 = j;int out2 = j;int out3 = j;int out4 = j;
int out5 = j;int out6 = j;int out7 = j;int out8 = j;

*pInputL2 = (unsigned char)(out1);
*pInputL2 = (unsigned char)(out2);
*pInputL2 = (unsigned char)(out3);
*pInputL2 = (unsigned char)(out4);
*pInputL2 = (unsigned char)(out5);
*pInputL2 = (unsigned char)(out6);
*pInputL2 = (unsigned char)(out7);
*pInputL2 = (unsigned char)(out8);
}
}

WH_time[1] = _itoll(TSCH, TSCL);
WH_cost[0] = (double)(WH_time[1] - WH_time[0]) / 750000;
Vps_printf("Write L2 1-add %f ms\n", WH_cost[0]);
}

{
unsigned long long WH_time[10];
double WH_cost[10];
TSCH = 0;
TSCL = 0;
WH_time[0] = _itoll(TSCH, TSCL);

for(i = 0; i < 1024; ++i)
{
unsigned char *pInputL2 = pInputBufL2;
for(j = 0;j < 100*1024; j += 8)
{
int out1 = j;int out2 = j;int out3 = j;int out4 = j;
int out5 = j;int out6 = j;int out7 = j;int out8 = j;

*(pInputL2++) = (unsigned char)(out1);
*(pInputL2++) = (unsigned char)(out2);
*(pInputL2++) = (unsigned char)(out3);
*(pInputL2++) = (unsigned char)(out4);
*(pInputL2++) = (unsigned char)(out5);
*(pInputL2++) = (unsigned char)(out6);
*(pInputL2++) = (unsigned char)(out7);
*(pInputL2++) = (unsigned char)(out8);
}
}

WH_time[1] = _itoll(TSCH, TSCL);
WH_cost[0] = (double)(WH_time[1] - WH_time[0]) / 750000;
Vps_printf("Write L2 adds %f ms\n", WH_cost[0]);
}

return ret;
}

  • Hi

    What is the L2 Address you are using the code? The performance is poorer if you are using the L3 address of the DSP L2 RAM versus the local address of L2 SRAM.

    Also, I see you are not using the full 64 bit bus of DSP for data read write. I would suggest you to have a look at the section 6 of www.ti.com/.../sprac21.pdf

    Thanks and Regards
    Piyali
  • In reply to Piyali Goswami:

    In our project, we used this method to get the address of L2 Address :
    L2buf = Utils_memAlloc(UTILS_HEAPID_L2_LOCAL, 200*1024, 32);
    The first address of l2 is 0x80000. Do you think there is a problem with the l2 address obtained like this?
  • In reply to user5957510:

    The address is correct. I would request you to use the routines mentioned in the app note reference from the previous post and compare the performance.

    thanks and Regards,
    Piyali

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.