[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7753 - in gnuradio/branches/developers/eb/gcell/src:
From: |
eb |
Subject: |
[Commit-gnuradio] r7753 - in gnuradio/branches/developers/eb/gcell/src: include lib lib/spu |
Date: |
Wed, 20 Feb 2008 11:07:13 -0700 (MST) |
Author: eb
Date: 2008-02-20 11:07:12 -0700 (Wed, 20 Feb 2008)
New Revision: 7753
Modified:
gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
gnuradio/branches/developers/eb/gcell/src/lib/spu/spu_buffers.c
Log:
"get" job args (inbound to SPE) are working for all alignments and sizes.
Modified: gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
2008-02-20 07:23:07 UTC (rev 7752)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
2008-02-20 18:07:12 UTC (rev 7753)
@@ -62,10 +62,8 @@
JS_SHUTTING_DOWN, // job mananger is shutting down
JS_TOO_MANY_CLIENTS, // too many client threads
JS_UNKNOWN_PROC, // didn't recognize the procedure ID
- JS_BAD_SIGNATURE, // arg counts and/or types are wrong for given
method
JS_BAD_DIRECTION, // EA arg has invalid direction
- JS_BAD_ALIGNMENT, // EA arg not 16-byte aligned
- JS_BAD_LENGTH, // EA arg length not a multiple of 16 bytes long
+ JS_BAD_EAH, // not all EA args have the same high 32 address
bits
JS_BAD_N_DIRECT, // too many direct args
JS_BAD_N_EA, // too many EA args
JS_ARGS_TOO_LONG, // total length of EA args exceeds limit
@@ -141,16 +139,16 @@
//! EA address of buffer (in)
gc_eaddr_t ea_addr;
- //! GC_JD_DMA_* get arg, put arg or both (in)
+ //! GC_JD_DMA_* get arg or put arg (in)
uint32_t direction;
//! number of bytes to get (in)
uint32_t get_size;
- //! maximum number of bytes to put (in: GCJD_DMA_PUT and GCJD_DMA_GET_PUT)
+ //! maximum number of bytes to put (in: GCJD_DMA_PUT)
uint32_t max_put_size;
- //! actual number of bytes put (out: GCJD_DMA_GET and GCJD_DMA_GET_PUT)
+ //! actual number of bytes put (out: GCJD_DMA_PUT)
uint32_t actual_put_size; // must be <= max_put_size
#if defined(__SPU__)
Modified: gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
2008-02-20 07:23:07 UTC (rev 7752)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
2008-02-20 18:07:12 UTC (rev 7753)
@@ -318,37 +318,106 @@
mgr->free_job_desc(jd);
}
+static const int NS = 32768;
+static short short_buf[NS] _AL128; // for known alignment
+static const int MAX_SPU_BUF = 32768; // FIXME really comes from spu
+
+//
+// test all "get" alignments and sizes
+//
void
qa_job_manager::t7_body()
{
gc_job_manager *mgr;
gc_jm_options opts;
- opts.nspes = 0; // use them all
+ opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
- static const int NS = 32768;
- static short buf[NS] _AL128; // for known alignment
for (int i = 0; i < NS; i++) // init buffer with known qty
- buf[i] = 0x1234 + i;
+ short_buf[i] = 0x1234 + i;
for (int offset = 0; offset <= 256; offset++){
for (int len = 0; len <= 256; len++){
- test_sum_shorts(mgr, &buf[offset], len);
+ test_sum_shorts(mgr, &short_buf[offset], len);
}
}
+ // confirm maximum length (FIXME max really defined on spu)
+ for (int offset = 0; offset < 128; offset++){
+ test_sum_shorts(mgr, &short_buf[offset], MAX_SPU_BUF/sizeof(short));
+ }
+
delete mgr;
}
+//
+// test "get" args too long
+//
void
qa_job_manager::t8_body()
{
+ gc_job_manager *mgr;
+ gc_jm_options opts;
+ opts.nspes = 1;
+ mgr = gc_make_job_manager(&opts);
+ gc_job_desc *jd = mgr->alloc_job_desc();
+
+ init_jd(jd, GCP_QA_SUM_SHORTS);
+ jd->eaa.nargs = 1;
+ jd->eaa.arg[0].ea_addr = 0;
+ jd->eaa.arg[0].direction = GCJD_DMA_GET;
+ jd->eaa.arg[0].get_size = 1 << 20;
+
+ if (!mgr->submit_job(jd)){
+ printf("submit_job(jd) failed, status = %d\n", jd->status);
+ }
+ else {
+ mgr->wait_job(jd);
+ CPPUNIT_ASSERT_EQUAL(JS_ARGS_TOO_LONG, jd->status);
+ }
+
+ mgr->free_job_desc(jd);
+ delete mgr;
}
+//
+// test MAX_ARGS_EA case
+//
void
qa_job_manager::t9_body()
{
+ static const int N = 127;
+ static const int M = 201;
+ gc_job_manager *mgr;
+ gc_jm_options opts;
+ opts.nspes = 1;
+ mgr = gc_make_job_manager(&opts);
+ gc_job_desc *jd = mgr->alloc_job_desc();
+
+ init_jd(jd, GCP_QA_SUM_SHORTS);
+ jd->eaa.nargs = MAX_ARGS_EA;
+ for (int i = 0; i < MAX_ARGS_EA; i++){
+ jd->eaa.arg[i].direction = GCJD_DMA_GET;
+ jd->eaa.arg[i].ea_addr = ptr_to_ea(&short_buf[i * M]);
+ jd->eaa.arg[i].get_size = N * sizeof(short);
+ }
+
+ if (!mgr->submit_job(jd)){
+ printf("submit_job(jd) failed, status = %d\n", jd->status);
+ }
+ else {
+ mgr->wait_job(jd);
+ CPPUNIT_ASSERT_EQUAL(JS_OK, jd->status);
+ for (int i = 0; i < MAX_ARGS_EA; i++){
+ int expected = sum_shorts(&short_buf[i * M], N);
+ int actual = jd->output.arg[i].s32;
+ CPPUNIT_ASSERT_EQUAL(expected, actual);
+ }
+ }
+
+ mgr->free_job_desc(jd);
+ delete mgr;
}
void
Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
2008-02-20 07:23:07 UTC (rev 7752)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
2008-02-20 18:07:12 UTC (rev 7753)
@@ -40,7 +40,7 @@
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
-//! round x down to p2 boudary (p2 must be a power-of-2)
+//! round x down to p2 boundary (p2 must be a power-of-2)
#define ROUND_DN(x, p2) ((x) & ~((p2)-1))
//! round x up to p2 boundary (p2 must be a power-of-2)
@@ -108,7 +108,7 @@
// dma the comp_info out to PPE
int tag = ci_tags + ci_idx;
- mfc_putf(&comp_info, spu_args.comp_info[ci_idx], sizeof(gc_comp_info_t),
tag, 0, 0);
+ mfc_put(&comp_info, spu_args.comp_info[ci_idx], sizeof(gc_comp_info_t), tag,
0, 0);
mfc_write_tag_mask(1 << tag); // the tag we're interested in
mfc_read_tag_status_all(); // wait for DMA to complete
@@ -181,18 +181,6 @@
void
process_job(gc_eaddr_t jd_ea, gc_job_desc_t *jd)
{
- // FIXME do something useful ;)
-
- if (0){
- static int total_jobs = 0;
- total_jobs++;
- printf("spe[%2d]: tij =%6d\n", spu_args.spu_idx, total_jobs);
- }
-
- if (0)
- printf("spu[%d]: job_id = %3d client_id = %3d\n",
- spu_args.spu_idx, jd->sys.job_id, jd->sys.client_id);
-
jd->status = JS_OK; // assume success
if (jd->proc_id >= GCP_NPROC_IDS || gc_proc_table[jd->proc_id] == 0){
@@ -216,34 +204,55 @@
memset(dma_list, 0, sizeof(dma_list));
int li = 0;
+ // for now, all EA's must have the same high 32-bits
+ gc_eaddr_t common_ea = eaa->arg[0].ea_addr;
+ unsigned int common_eah = mfc_ea2h(common_ea);
+
unsigned char *gb_base = gc_getbuf[0];
unsigned char *p = gb_base;
+ unsigned int total_get_dma_len = 0;
// unsigned int pbi = 0; // put buffer index
// unsigned char *pb_base = gc_putbuf[pbi];
+
// assign LS addresses for buffers
- gc_eaddr_t ea_base = 0;
- unsigned char *ls_base;
- int offset;
- unsigned int dma_len;
+ for (unsigned int i = 0; i < eaa->nargs; i++){
- for (unsigned int i = 0; i < eaa->nargs; i++){
+ gc_eaddr_t ea_base = 0;
+ unsigned char *ls_base;
+ int offset;
+ unsigned int dma_len;
+
if (eaa->arg[i].direction == GCJD_DMA_GET){
ea_base = ROUND_DN(eaa->arg[i].ea_addr, (gc_eaddr_t) CACHE_LINE_SIZE);
+ if (mfc_ea2h(ea_base) != common_eah){
+ jd->status = JS_BAD_EAH;
+ goto wrap_up;
+ }
+
offset = eaa->arg[i].ea_addr & (CACHE_LINE_SIZE-1);
dma_len = ROUND_UP(eaa->arg[i].get_size + offset, CACHE_LINE_SIZE);
+ total_get_dma_len += dma_len;
+
+ if (total_get_dma_len > GC_SPU_BUFSIZE){
+ jd->status = JS_ARGS_TOO_LONG;
+ goto wrap_up;
+ }
+
ls_base = p;
p += dma_len;
eaa->arg[i].ls_addr = ls_base + offset;
- assert((mfc_ea2l(eaa->arg[i].ea_addr) & 0x7f) ==
((intptr_t)eaa->arg[i].ls_addr & 0x7f));
- assert((ea_base & 0x7f) == 0);
- assert(((intptr_t)ls_base & 0x7f) == 0);
- assert((dma_len & 0x7f) == 0);
- assert((eaa->arg[i].get_size <= dma_len)
- && dma_len <= (eaa->arg[i].get_size + offset + CACHE_LINE_SIZE
- 1));
+ if (0){
+ assert((mfc_ea2l(eaa->arg[i].ea_addr) & 0x7f) ==
((intptr_t)eaa->arg[i].ls_addr & 0x7f));
+ assert((ea_base & 0x7f) == 0);
+ assert(((intptr_t)ls_base & 0x7f) == 0);
+ assert((dma_len & 0x7f) == 0);
+ assert((eaa->arg[i].get_size <= dma_len)
+ && dma_len <= (eaa->arg[i].get_size + offset +
CACHE_LINE_SIZE - 1));
+ }
if (0){
printf("eaa->arg[%d]\n", i);
@@ -254,7 +263,7 @@
}
// add to dma list
- // FIXME not correct if top 32-bits of all EA's are NOT the same
+ // FIXME (someday) this is where the JS_BAD_EAH limitation comes from
while (dma_len != 0){
int n = MIN(dma_len, MFC_MAX_DMA_SIZE);
dma_list[li].size = n;
@@ -271,7 +280,7 @@
}
// fire off the dma to fetch the args and wait for it to complete
- mfc_getl(gb_base, ea_base, dma_list, li*sizeof(dma_list[0]), get_tag, 0,
0);
+ mfc_getl(gb_base, common_ea, dma_list, li*sizeof(dma_list[0]), get_tag,
0, 0);
mfc_write_tag_mask(1 << get_tag); // the tag we're
interested in
mfc_read_tag_status_all(); // wait for DMA to complete
@@ -282,6 +291,8 @@
}
}
+ wrap_up:; // semicolon creates null statement for C99 compliance
+
// Copy job descriptor back out to EA.
// (The dma will be waited on in flush_completion_info)
int tag = ci_tags + ci_idx; // use the current completion
tag
Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/spu_buffers.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/spu_buffers.c
2008-02-20 07:23:07 UTC (rev 7752)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/spu_buffers.c
2008-02-20 18:07:12 UTC (rev 7753)
@@ -22,8 +22,8 @@
#include <spu_buffers.h>
#include <compiler.h>
-static unsigned char _getbuf[GC_SPU_BUFSIZE][NGETBUFS] _AL128;
-static unsigned char _putbuf[GC_SPU_BUFSIZE][NPUTBUFS] _AL128;
+static unsigned char _getbuf[NGETBUFS][GC_SPU_BUFSIZE] _AL128;
+static unsigned char _putbuf[NPUTBUFS][GC_SPU_BUFSIZE] _AL128;
unsigned char *gc_getbuf[NGETBUFS] = {
_getbuf[0]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7753 - in gnuradio/branches/developers/eb/gcell/src: include lib lib/spu,
eb <=