[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10224 - in gnuradio/branches/developers/eb/gcell-wip/
From: |
eb |
Subject: |
[Commit-gnuradio] r10224 - in gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime: . spu |
Date: |
Wed, 14 Jan 2009 21:05:04 -0700 (MST) |
Author: eb
Date: 2009-01-14 21:05:03 -0700 (Wed, 14 Jan 2009)
New Revision: 10224
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.cc
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.h
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_main.c
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_spu_jd_queue.c
Log:
work-in-progress: wake spe with mbox message
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.cc
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.cc
2009-01-14 08:25:44 UTC (rev 10223)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.cc
2009-01-15 04:05:03 UTC (rev 10224)
@@ -48,6 +48,14 @@
#define __db16cyc() __asm__ volatile ("or 31,31,31" : : : "memory")
+#if 1
+#define CCTPL() __cctpl()
+#define CCTPM() __cctpm()
+#else
+#define CCTPL() (void) 0
+#define CCTPM() (void) 0
+#endif
+
static const size_t CACHE_LINE_SIZE = 128;
static const unsigned int DEFAULT_MAX_JOBS = 128;
@@ -109,6 +117,7 @@
d_eh_cond(&d_eh_mutex), d_eh_thread(0), d_eh_state(EHS_INIT),
d_shutdown_requested(false),
d_jc_cond(&d_jc_mutex), d_jc_thread(0), d_jc_state(JCS_INIT),
d_jc_njobs_active(0),
+ d_ntell(0), d_tell_start(0),
d_client_thread(0), d_ea_args_maxsize(0),
d_proc_def(0), d_proc_def_ls_addr(0), d_nproc_defs(0)
{
@@ -187,6 +196,8 @@
}
}
+ d_ntell = std::min(d_options.nspes, 2U);
+
// ----------------------------------------------------------------
// initalize the job queue
@@ -675,11 +686,20 @@
void
gc_job_manager_impl::tell_spes_to_check_queue()
{
- for (unsigned int i = 0; i < d_options.nspes; i++){
- volatile spe_spu_control_area_t *spe_ctrl = d_worker[i].spe_ctrl;
+ int nspes = d_options.nspes;
+
+ for (int i = 0, ntold = 0; ntold < d_ntell && i < nspes ; ++i){
+ volatile spe_spu_control_area_t *spe_ctrl =
d_worker[d_tell_start].spe_ctrl;
int nfree = (spe_ctrl->SPU_Mbox_Stat >> 8) & 0xFF;
- if (nfree != 0)
+ if (nfree == 4){
spe_ctrl->SPU_In_Mbox = MK_MBOX_MSG(OP_CHECK_QUEUE, 0);
+ ntold++;
+ }
+
+ unsigned int t = d_tell_start + 1;
+ if (t >= d_options.nspes)
+ t = 0;
+ d_tell_start = t;
}
}
@@ -1059,7 +1079,7 @@
gc_job_manager_impl::event_handler_loop()
{
static const int MAX_EVENTS = 16;
- static const int TIMEOUT = 50; // how long to block in milliseconds
+ static const int TIMEOUT = 20; // how long to block in milliseconds
spe_event_unit_t events[MAX_EVENTS];
@@ -1128,7 +1148,7 @@
{
static const int niter = 10000;
- __cctpl(); // change current (h/w) thread priority to low
+ CCTPL(); // change current (h/w) thread priority to low
for (int n = 0; n < niter; n++){
@@ -1142,9 +1162,9 @@
if (debug())
printf("jc: job_done (0x%08x) from spu[%d]\n", msg, spe_num);
- __cctpm(); // change current thread priority to medium
+ CCTPM(); // change current thread priority to medium
notify_clients_jobs_are_done(spe_num, MBOX_MSG_ARG(msg));
- __cctpl();
+ CCTPL();
break;
default:
@@ -1154,7 +1174,7 @@
}
}
}
- __cctpm();
+ CCTPM();
}
//
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.h
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.h
2009-01-14 08:25:44 UTC (rev 10223)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.h
2009-01-15 04:05:03 UTC (rev 10224)
@@ -121,6 +121,10 @@
volatile job_completer_state d_jc_state;
int d_jc_njobs_active; // # of jobs submitted but not
yet reaped
+ // round robin notification of spes
+ int d_ntell; // # of spes to tell
+ unsigned int d_tell_start; // which one to start with
+
// All of the job descriptors are hung off of here.
// We allocate them all in a single cache aligned chunk.
gc_job_desc_t *d_jd; // [options.max_jobs]
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_main.c
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_main.c
2009-01-14 08:25:44 UTC (rev 10223)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_main.c
2009-01-15 04:05:03 UTC (rev 10224)
@@ -52,14 +52,16 @@
//#define OUT_MBOX_CHANNEL SPU_WrOutIntrMbox
#define OUT_MBOX_CHANNEL SPU_WrOutMbox
+#define CHECK_QUEUE_ON_MSG 1 // define to 0 or 1
#define USE_LLR_LOST_EVENT 0 // define to 0 or 1
-#define CHECK_QUEUE_ON_MSG 1 // define to 0 or 1
int gc_sys_tag; // tag for misc DMA operations
static gc_spu_args_t spu_args;
static struct gc_proc_def *gc_proc_def; // procedure entry points
+extern int jdq_empty, jdq_locked, jdq_ok;
+
// ------------------------------------------------------------------------
// state for DMA'ing arguments in and out
@@ -664,9 +666,8 @@
if (MBOX_MSG_OP(msg) == OP_CHECK_QUEUE){
while (1){
- int delay = (int)(3200.0 * gc_uniform_deviate()); // uniformly in
[0, 1.0us]
- gc_cdelay(delay);
- //gc_cdelay(4095);
+ //int delay = (int)(3200.0 * gc_uniform_deviate()); // uniformly in
[0, 1.0us]
+ //gc_cdelay(delay);
gc_dequeue_status_t s =
gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd);
@@ -690,6 +691,10 @@
else if (MBOX_MSG_OP(msg) == OP_EXIT){
flush_completion_info();
+ if (1){
+ printf("spu[%2d] jdq_empty = %8d jdq_locked = %8d jdq_ok = %8d\n",
+ spu_args.spu_idx, jdq_empty, jdq_locked, jdq_ok);
+ }
return;
}
else if (MBOX_MSG_OP(msg) == OP_GET_SPU_BUFSIZE){
Modified:
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_spu_jd_queue.c
===================================================================
---
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_spu_jd_queue.c
2009-01-14 08:25:44 UTC (rev 10223)
+++
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_spu_jd_queue.c
2009-01-15 04:05:03 UTC (rev 10224)
@@ -29,6 +29,12 @@
extern int gc_sys_tag;
+// keep track of stats
+int jdq_ok;
+int jdq_empty;
+int jdq_locked;
+
+
#define INITIAL_BACKOFF 32.0
#define MAX_BACKOFF 8192.0 /* 2.6us */
#define RANDOM_WEIGHT 0.2
@@ -65,11 +71,15 @@
mfc_getllar(local_q, q, 0, 0);
spu_readch(MFC_RdAtomicStat);
- if (local_q->mutex != 0) // somebody else has it locked
+ if (local_q->mutex != 0){ // somebody else has it locked
+ jdq_locked++;
return GCQ_LOCKED;
+ }
- if (local_q->head == 0) // the queue is empty
+ if (local_q->head == 0){ // the queue is empty
+ jdq_empty++;
return GCQ_EMPTY;
+ }
// Try to acquire the lock
@@ -108,5 +118,6 @@
mfc_putlluc(local_q, q, 0, 0);
spu_readch(MFC_RdAtomicStat);
+ jdq_ok++;
return GCQ_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10224 - in gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime: . spu,
eb <=