Skip to content

Commit

Permalink
Refactor PUT and Large PUT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RipleyTom committed Feb 28, 2024
1 parent 62c7fc1 commit 5e47a35
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
13 changes: 11 additions & 2 deletions task_largeput.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,20 @@ uint8_t ls_buf[16384] __attribute__((aligned(128)));

int cellSpursTaskMain(qword argTask, uint64_t argTaskset)
{
const uint64_t addr = argTaskset;
const uint64_t task_id = ((vec_uint4)argTask)[0];
const uint64_t task_mask = 1 << task_id;
const uint64_t addr = argTaskset + (task_id * 16384);

for (int index = 0; index < 16384; index++)
{
ls_buf[index] = (index + task_id) % 0xFF;
}

for (unsigned long counter = 0; counter < NUM_LARGE_PUTC; counter++)
{
cellDmaPut(ls_buf, addr, 16384, 0, 0, 0);
cellDmaPut(ls_buf, addr, 16384, task_id, 0, 0);
ls_buf[counter % 16384]++;
cellDmaWaitTagStatusAny(task_mask);
}

return 0;
Expand Down
9 changes: 6 additions & 3 deletions task_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

CELL_SPU_LS_PARAM(16 * 1024, 16 * 1024);

#define NUM_PUTC 10000000
#define NUM_PUTC 30000000

vec_uint4 ls_buf[128 / sizeof(vec_uint4)] __attribute__((aligned(128)));

int cellSpursTaskMain(qword argTask, uint64_t argTaskset)
{
const uint64_t addr = argTaskset;
const uint64_t task_id = ((vec_uint4)argTask)[0];
const uint64_t task_mask = 1 << task_id;
const uint64_t addr = argTaskset + (task_id * 128);

for (int index = 0; index < (128 / sizeof(vec_uint4)); index++)
{
Expand All @@ -26,8 +28,9 @@ int cellSpursTaskMain(qword argTask, uint64_t argTaskset)

for (unsigned long counter = 0; counter < NUM_PUTC; counter++)
{
cellDmaPut(&ls_buf[counter % ((128 - 32) / sizeof(vec_uint4))], addr, 32, 0, 0, 0);
cellDmaPut(&ls_buf[counter % ((128 - 32) / sizeof(vec_uint4))], addr, 32, task_id, 0, 0);
ls_buf[counter % (128 / sizeof(vec_uint4))] = spu_add(ls_buf[counter % (128 / sizeof(vec_uint4))], toinc);
cellDmaWaitTagStatusAny(task_mask);
}

return 0;
Expand Down
4 changes: 2 additions & 2 deletions test_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define NUM_SPU 6

unsigned char bigbuf[128] __attribute__((aligned(128)));
unsigned char bigbuf[128 * NUM_SPU] __attribute__((aligned(128)));

int test_block(CellSpurs2 *spurs2, const CellSpursTaskBinInfo *program)
{
Expand All @@ -31,7 +31,7 @@ int test_block(CellSpurs2 *spurs2, const CellSpursTaskBinInfo *program)
ctx[index] = memalign(128, program->sizeContext);
for (int subdex = 0; subdex < 4; subdex++)
{
args[index].u32[subdex] = (index * 10000000) + subdex;
args[index].u32[subdex] = index + (subdex * 16);
}

ret = cellSpursCreateTask2WithBinInfo(taskset, &tids[index], program, &args[index], ctx[index], NULL, NULL);
Expand Down
4 changes: 2 additions & 2 deletions test_largeblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#define NUM_SPU 6

unsigned char largebuf[16384] __attribute__((aligned(128)));
unsigned char largebuf[16384 * NUM_SPU] __attribute__((aligned(128)));

int test_largeblock(CellSpurs2 *spurs2, const CellSpursTaskBinInfo *program)
{
Expand All @@ -31,7 +31,7 @@ int test_largeblock(CellSpurs2 *spurs2, const CellSpursTaskBinInfo *program)
ctx[index] = memalign(128, program->sizeContext);
for (int subdex = 0; subdex < 4; subdex++)
{
args[index].u32[subdex] = (index * 10000000) + subdex;
args[index].u32[subdex] = index + (subdex * 16);
}

ret = cellSpursCreateTask2WithBinInfo(taskset, &tids[index], program, &args[index], ctx[index], NULL, NULL);
Expand Down

0 comments on commit 5e47a35

Please sign in to comment.