commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10220 - in gnuradio/branches/developers/eb/gcell-wip/


From: eb
Subject: [Commit-gnuradio] r10220 - in gnuradio/branches/developers/eb/gcell-wip/gcell: apps include/gcell include/gcell/spu lib/runtime lib/runtime/spu
Date: Tue, 13 Jan 2009 22:48:19 -0700 (MST)

Author: eb
Date: 2009-01-13 22:48:19 -0700 (Tue, 13 Jan 2009)
New Revision: 10220

Modified:
   gnuradio/branches/developers/eb/gcell-wip/gcell/apps/plot_speedup.py
   gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/gc_mbox.h
   
gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/spu/gc_jd_queue.h
   
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 up spes with message

Modified: gnuradio/branches/developers/eb/gcell-wip/gcell/apps/plot_speedup.py
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/apps/plot_speedup.py        
2009-01-14 05:06:23 UTC (rev 10219)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/apps/plot_speedup.py        
2009-01-14 05:48:19 UTC (rev 10220)
@@ -36,6 +36,7 @@
 
 
         self.markers = {
+              5 : 'x',
              10 : 'o',
              50 : 's',
             100 : '^',

Modified: 
gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/gc_mbox.h
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/gc_mbox.h     
2009-01-14 05:06:23 UTC (rev 10219)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/gc_mbox.h     
2009-01-14 05:48:19 UTC (rev 10220)
@@ -41,12 +41,13 @@
 
 #define OP_EXIT                        0x0     // exit now
 #define        OP_GET_SPU_BUFSIZE      0x1 
+#define        OP_CHECK_QUEUE          0x2
 
 // SPE to PPE (sent via SPE Write Outbound Interrupt Mailbox)
 
-#define OP_JOBS_DONE           0x2     // arg is 0 or 1, indicating which
+#define OP_JOBS_DONE           0x3     // arg is 0 or 1, indicating which
                                        //   gc_completion_info_t contains the 
info
-#define        OP_SPU_BUFSIZE          0x3     // arg is max number of bytes
+#define        OP_SPU_BUFSIZE          0x4     // arg is max number of bytes
 
 
 #endif /* INCLUDED_GCELL_GC_MBOX_H */

Modified: 
gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/spu/gc_jd_queue.h
===================================================================
--- 
gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/spu/gc_jd_queue.h 
    2009-01-14 05:06:23 UTC (rev 10219)
+++ 
gnuradio/branches/developers/eb/gcell-wip/gcell/include/gcell/spu/gc_jd_queue.h 
    2009-01-14 05:48:19 UTC (rev 10220)
@@ -30,6 +30,12 @@
 
 __GC_BEGIN_DECLS
 
+typedef enum {
+  GCQ_OK,              // Got an item
+  GCQ_EMPTY,           // Q is empty
+  GCQ_LOCKED,          // Somebody else has the queue locked
+} gc_dequeue_status_t;
+
 /*!
  * \brief Remove and return item at head of queue.
  *
@@ -40,10 +46,10 @@
  * \returns false if the queue is empty, otherwise returns true
  *   and sets \p item_ea and DMA's job descriptor into \p item
  *
- * If return is false, we're holding a lock-line reservation that
+ * If return is not GCQ_OK, we're holding a lock-line reservation that
  * covers the queue.
  */
-bool
+gc_dequeue_status_t
 gc_jd_queue_dequeue(gc_eaddr_t q, gc_eaddr_t *item_ea,
                    int jd_tag, gc_job_desc_t *item);
 

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 05:06:23 UTC (rev 10219)
+++ 
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.cc
  2009-01-14 05:48:19 UTC (rev 10220)
@@ -561,6 +561,7 @@
 
   incr_njobs_active();
   gc_jd_queue_enqueue(d_queue, jd);
+  tell_spes_to_check_queue();
   return true;
 }
 
@@ -664,6 +665,18 @@
   return r == 1;
 }
 
+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 nfree = (spe_ctrl->SPU_Mbox_Stat >> 8) & 0xFF;
+    if (nfree != 0)
+      spe_ctrl->SPU_In_Mbox = MK_MBOX_MSG(OP_CHECK_QUEUE, 0);
+  }
+}
+
+
 ////////////////////////////////////////////////////////////////////////
 
 static void

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 05:06:23 UTC (rev 10219)
+++ 
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/gc_job_manager_impl.h
   2009-01-14 05:48:19 UTC (rev 10220)
@@ -165,6 +165,7 @@
   void handle_event(spe_event_unit_t *evt);
   void incr_njobs_active();
   void decr_njobs_active(int n);
+  void tell_spes_to_check_queue();
   void poll_for_job_completion();
 
   // bitvector ops

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 05:06:23 UTC (rev 10219)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_main.c   
2009-01-14 05:48:19 UTC (rev 10220)
@@ -53,6 +53,7 @@
 #define OUT_MBOX_CHANNEL SPU_WrOutMbox
 
 #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;
@@ -155,6 +156,7 @@
 
 // ------------------------------------------------------------------------
 
+
 static unsigned int backoff;           // current backoff value in clock cycles
 static unsigned int _backoff_start;
 static unsigned int _backoff_cap;
@@ -194,6 +196,8 @@
   backoff = _backoff_start;
 }
 
+#if !CHECK_QUEUE_ON_MSG
+
 static void 
 backoff_reset(void)
 {
@@ -229,6 +233,7 @@
 }
 
 #endif
+#endif // !CHECK_QUEUE_ON_MSG
 
 // ------------------------------------------------------------------------
 
@@ -603,6 +608,7 @@
 
   while (1){
 
+#if !CHECK_QUEUE_ON_MSG
 #if (USE_LLR_LOST_EVENT)
 
     if (unlikely(spu_readchcnt(SPU_RdEventStat))){
@@ -622,7 +628,7 @@
        // by somebody doing something to the queue.  Go look and see
        // if there's anything for us.
        //
-       while (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, 
&jd))
+       while (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, 
&jd) == GCQ_OK)
          process_job(jd_ea, &jd);
       }
 
@@ -635,7 +641,7 @@
 #else
 
     // try to get a job from the job queue 
-    if (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd)){
+    if (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd) == 
GCQ_OK){
       total_jobs++;
       gc_log_write2(GCL_SS_SYS, 0x10, jd.sys.job_id, total_jobs);
 
@@ -648,17 +654,45 @@
       backoff_delay();
 
 #endif
+#endif
 
     // any msgs for us?
 
     if (unlikely(spu_readchcnt(SPU_RdInMbox))){
       int msg = spu_readch(SPU_RdInMbox);
       // printf("spu[%d] mbox_msg: 0x%08x\n", spu_args.spu_idx, msg);
-      if (MBOX_MSG_OP(msg) == OP_EXIT){
+      if (MBOX_MSG_OP(msg) == OP_CHECK_QUEUE){
+
+       while (1){
+         //int delay = (int)(8191.0 * gc_uniform_deviate());   // uniformly in 
[0, 2.6us]
+         //gc_cdelay(delay);
+         gc_cdelay(4095);
+
+         gc_dequeue_status_t s =
+           gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd);
+
+         if (s == GCQ_OK){
+           total_jobs++;
+           gc_log_write2(GCL_SS_SYS, 0x10, jd.sys.job_id, total_jobs);
+
+           process_job(jd_ea, &jd); 
+
+           gc_log_write2(GCL_SS_SYS, 0x11, jd.sys.job_id, total_jobs);
+         }
+
+         else if (s == GCQ_EMPTY){
+           break;
+         }
+         else {        // GCQ_LOCKED -- keep trying
+         }
+       }
+      }
+
+      else if (MBOX_MSG_OP(msg) == OP_EXIT){
        flush_completion_info();
        return;
       }
-      if (MBOX_MSG_OP(msg) == OP_GET_SPU_BUFSIZE){
+      else if (MBOX_MSG_OP(msg) == OP_GET_SPU_BUFSIZE){
        spu_writech(SPU_WrOutIntrMbox, MK_MBOX_MSG(OP_SPU_BUFSIZE, 
GC_SPU_BUFSIZE_BASE));
       }
     }

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 05:06:23 UTC (rev 10219)
+++ 
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_spu_jd_queue.c
   2009-01-14 05:48:19 UTC (rev 10220)
@@ -47,7 +47,7 @@
   return t;
 }
 
-bool
+gc_dequeue_status_t
 gc_jd_queue_dequeue(gc_eaddr_t q, gc_eaddr_t *item_ea,
                    int jd_tag, gc_job_desc_t *item)
 {
@@ -66,10 +66,10 @@
     spu_readch(MFC_RdAtomicStat);
 
     if (local_q->mutex != 0)           // somebody else has it locked
-      return false;
+      return GCQ_LOCKED;
 
     if (local_q->head == 0)            // the queue is empty
-      return false;
+      return GCQ_EMPTY;
 
     // Try to acquire the lock
 
@@ -108,5 +108,5 @@
   mfc_putlluc(local_q, q, 0, 0);
   spu_readch(MFC_RdAtomicStat);
 
-  return true;
+  return GCQ_OK;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]