commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: eb
Subject: [Commit-gnuradio] r7933 - in gnuradio/branches/developers/eb/gcell-wip/src: apps lib lib/spu
Date: Wed, 5 Mar 2008 09:49:52 -0700 (MST)

Author: eb
Date: 2008-03-05 09:49:51 -0700 (Wed, 05 Mar 2008)
New Revision: 7933

Modified:
   gnuradio/branches/developers/eb/gcell-wip/src/apps/Makefile.am
   gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_dma.cc
   gnuradio/branches/developers/eb/gcell-wip/src/lib/Makefile.am
   gnuradio/branches/developers/eb/gcell-wip/src/lib/qa_job_manager.cc
   gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_main.c
Log:
gcell work-in-progress

Modified: gnuradio/branches/developers/eb/gcell-wip/src/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/apps/Makefile.am      
2008-03-05 15:45:49 UTC (rev 7932)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/Makefile.am      
2008-03-05 16:49:51 UTC (rev 7933)
@@ -31,11 +31,13 @@
 
 
 noinst_PROGRAMS = \
-       test_all \
        benchmark_dma \
        benchmark_nop
 
+bin_PROGRAMS = \
+       test_all
 
+
 test_all_SOURCES = test_all.cc
 test_all_LDADD = $(LIBGCELL_QA) $(LIBGCELL)
 

Modified: gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_dma.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_dma.cc 
2008-03-05 15:45:49 UTC (rev 7932)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_dma.cc 
2008-03-05 16:49:51 UTC (rev 7933)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <boost/scoped_array.hpp>
+#include <assert.h>
 
 // handle to embedded SPU executable that contains benchmark routines
 // (The name of the variable (benchmark_procs) is the name of the spu 
executable.)
@@ -37,6 +38,17 @@
 #define        BENCHMARK_GET_PUT       (BENCHMARK_PUT|BENCHMARK_GET)
 
 
+static bool
+power_of_2_p(unsigned long x)
+{
+  int nbits = sizeof(x) * 8;
+  for (int i = 0; i < nbits; i++)
+    if (x == (1UL << i))
+      return true;
+
+  return false;
+}
+
 static void
 init_jd(gc_job_desc *jd, unsigned int usecs,
        unsigned char *getbuf, unsigned char *putbuf, size_t buflen,
@@ -80,7 +92,8 @@
 {
   static const int64_t TOTAL_SIZE_DMA = 20LL << 30;
   static const int NJDS = 64;
-  unsigned int njobs = (unsigned int)(TOTAL_SIZE_DMA / dma_size);
+  //unsigned int njobs = (unsigned int)(TOTAL_SIZE_DMA / dma_size);
+  unsigned int njobs = NJDS * 16;
   unsigned int nsubmitted = 0;
   unsigned int ncompleted = 0;
   gc_job_desc *all_jds[NJDS];
@@ -91,6 +104,7 @@
   
   static const unsigned int BUFSIZE = (32 << 10) * NJDS;
   static const unsigned int BUFMASK = BUFSIZE - 1;
+  assert(power_of_2_p(BUFSIZE));
   unsigned char *getbuf = new unsigned char[BUFSIZE];
   boost::scoped_array<unsigned char> _getbuf(getbuf);
   unsigned char *putbuf = new unsigned char[BUFSIZE];
@@ -179,24 +193,14 @@
 
     double delta = (t_stop - t_start).double_time();
     printf("nspes: %2d  udelay: %4d  elapsed_time: %7.3f  dma_size: %5d  
dma_throughput: %7.3e\n",
-          mgr->nspes(), usecs, delta, dma_size,  (double) njobs * dma_size / 
delta);
+          mgr->nspes(), usecs, delta, dma_size,
+          (double) njobs * dma_size / delta * (getput_mask == 
BENCHMARK_GET_PUT ? 2.0 : 1.0));
 
   }
 
   delete mgr;
 }
 
-static bool
-power_of_2_p(unsigned long x)
-{
-  int nbits = sizeof(x) * 8;
-  for (int i = 0; i < nbits; i++)
-    if (x == (1UL << i))
-      return true;
-
-  return false;
-}
-
 static void
 usage()
 {

Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/Makefile.am       
2008-03-05 15:45:49 UTC (rev 7932)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/Makefile.am       
2008-03-05 16:49:51 UTC (rev 7933)
@@ -44,18 +44,18 @@
        qa_jd_stack.cc \
        qa_job_manager.cc
 
-# This kruft is required to link the SPU QA executable into the PPE shared lib 
w/o warnings
+# This kruft is required to link the QA SPU executable into the PPE shared lib 
w/o warnings
 gcell_qa.lo: spu/gcell_qa
        ppu-embedspu -m32 -fpic gcell_qa spu/gcell_qa .libs/gcell_qa.o
-       rm -f gcell_qa.lo
-       echo "# gcell_qa.lo - a libtool object file" >> gcell_qa.lo
-       echo "# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 
2005/12/18 22:14:06)" >> gcell_qa.lo
-       echo "#" >> gcell_qa.lo
-       echo "# Please DO NOT delete this file!" >> gcell_qa.lo
-       echo "# It is necessary for linking the library." >> gcell_qa.lo
-       echo "" >> gcell_qa.lo
-       echo "pic_object='.libs/gcell_qa.o'" >> gcell_qa.lo
-       echo "non_pic_object=none" >> gcell_qa.lo
+       @rm -f gcell_qa.lo
+       @echo "# gcell_qa.lo - a libtool object file" >> gcell_qa.lo
+       @echo "# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 
2005/12/18 22:14:06)" >> gcell_qa.lo
+       @echo "#" >> gcell_qa.lo
+       @echo "# Please DO NOT delete this file!" >> gcell_qa.lo
+       @echo "# It is necessary for linking the library." >> gcell_qa.lo
+       @echo "" >> gcell_qa.lo
+       @echo "pic_object='.libs/gcell_qa.o'" >> gcell_qa.lo
+       @echo "non_pic_object=none" >> gcell_qa.lo
 
 libgcell_qa_la_LIBADD = \
        gcell_qa.lo \

Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/qa_job_manager.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/qa_job_manager.cc 
2008-03-05 15:45:49 UTC (rev 7932)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/qa_job_manager.cc 
2008-03-05 16:49:51 UTC (rev 7933)
@@ -550,7 +550,7 @@
 }
 
 //
-// Test all "get" alignments and sizes
+// Test all "put" alignments and sizes
 //
 void
 qa_job_manager::t10_body()
@@ -723,9 +723,70 @@
   delete mgr;
 }
 
+/*
+ * Parallel submission of NJOBS "put" jobs will test double buffered puts.
+ */
 void
 qa_job_manager::t14_body()
 {
+  //static const int NJOBS = 64;
+  static const int NJOBS = 256;
+  static const int LEN_PER_JOB = 1021;
+  unsigned char    buf[NJOBS * LEN_PER_JOB];
+  gc_job_desc_t          *jd[NJOBS];
+  bool            done[NJOBS];
+
+  static const int STARTING_VAL = 13;
+
+  memset(buf, 0xff, LEN_PER_JOB * NJOBS);
+
+  gc_job_manager *mgr;
+  gc_jm_options opts;
+  opts.program_handle = &gcell_qa;
+  opts.nspes = 1;
+  mgr = gc_make_job_manager(&opts);
+
+
+  gc_proc_id_t gcp_qa_put_seq = mgr->lookup_proc("qa_put_seq");
+
+  // do all the initialization up front
+
+  for (int i = 0, val = STARTING_VAL; i < NJOBS; i++, val += 3){
+    jd[i] = mgr->alloc_job_desc();
+    init_jd(jd[i], gcp_qa_put_seq);
+    jd[i]->input.nargs = 1;
+    jd[i]->input.arg[0].s32 = val;
+    jd[i]->eaa.nargs = 1;
+    jd[i]->eaa.arg[0].ea_addr = ptr_to_ea(&buf[i * LEN_PER_JOB]);
+    jd[i]->eaa.arg[0].direction = GCJD_DMA_PUT;
+    jd[i]->eaa.arg[0].put_size = LEN_PER_JOB;
+  }
+
+  // submit them all
+
+  for (int i = 0; i < NJOBS; i++){
+    if (!mgr->submit_job(jd[i])){
+      printf("%d: submit_job(jd[%2d]) failed, status = %d\n", __LINE__, i, 
jd[i]->status);
+    }
+  }
+
+  // wait for them all
+
+  int n = mgr->wait_jobs(NJOBS, jd, done, GC_WAIT_ALL);
+  CPPUNIT_ASSERT_EQUAL(NJOBS, n);
+
+  // check results
+
+  for (int i = 0, val = STARTING_VAL; i < NJOBS; i++, val += 3){
+    CPPUNIT_ASSERT_EQUAL(JS_OK, jd[i]->status);
+    CPPUNIT_ASSERT(confirm_seq(&buf[i * LEN_PER_JOB], LEN_PER_JOB, val));
+  }
+  
+  // cleanup
+  for (int i = 0; i < NJOBS; i++)
+    mgr->free_job_desc(jd[i]);
+
+  delete mgr;
 }
 
 void

Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_main.c
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_main.c     
2008-03-05 15:45:49 UTC (rev 7932)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_main.c     
2008-03-05 16:49:51 UTC (rev 7933)
@@ -32,7 +32,7 @@
 #include "spu_buffers.h"
 #include <string.h>
 #include <assert.h>
-// #include <stdio.h>
+#include <stdio.h>
 
 
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
@@ -121,6 +121,10 @@
   if (put_in_progress & PBI_MASK(1))
     tag_mask |= (1 << (put_tags + 1));
 
+  if (0){
+    printf("fci: waiting for tag_mask 0x%08x\n", tag_mask);
+  }
+
   mfc_write_tag_mask(tag_mask);                // the tags we're interested in
   mfc_read_tag_status_all();           // wait for DMA to complete
   put_in_progress = 0;                 // mark them all complete
@@ -227,34 +231,16 @@
 handle_slow_and_tedious_dma(gc_eaddr_t ea, unsigned char *ls,
                            unsigned int len, int put_tag)
 {
-  // special case two likely cases, otherwise handle with divide and conquer
-  unsigned int t = (((uintptr_t) ls) | len) & 0x7;
-  if (1 && t == 0){            // 8 byte aligned and len is multiple of 8
-    mfc_put(ls, ea, 8, put_tag, 0, 0);
-  }
-  else if (1 && t == 4){       // 4-byte aligned and len is a multiple of 4
-    switch (len){
-    case 12:
-      mfc_put(ls + 8, ea + 8, 4, put_tag, 0, 0);
-    case  8:
-      mfc_put(ls + 4, ea + 4, 4, put_tag, 0, 0);
-    case  4:
-      mfc_put(ls + 0, ea + 0, 4, put_tag, 0, 0);
-      break;
-    }
-  }
-  else {
-    // General case (divide and conquer)
-    // This code is also correct for the two cases above
-    unsigned int alignment = ((uintptr_t) ls) & 0x7;
-    dc_work = make_mask(len) << alignment;
-    dc_ls_base = (unsigned char *) ROUND_DN((uintptr_t) ls, 8);
-    dc_ea_base = ROUND_DN(ea, (gc_eaddr_t) 8);
+  // Set up for divide and conquer
+  unsigned int alignment = ((uintptr_t) ls) & 0x7;
+  dc_work = make_mask(len) << alignment;
+  dc_ls_base = (unsigned char *) ROUND_DN((uintptr_t) ls, 8);
+  dc_ea_base = ROUND_DN(ea, (gc_eaddr_t) 8);
+  dc_put_tag = put_tag;
 
-    d_and_c( 0, 8);
-    d_and_c( 8, 8);
-    d_and_c(16, 8);
-  }
+  d_and_c( 0, 8);
+  d_and_c( 8, 8);
+  d_and_c(16, 8);
 }
 
 
@@ -300,9 +286,19 @@
       // Do we have any "put" args?  If so ensure that previous
       // dma from this buffer is complete
 
+      if (0){
+       printf("dir_union       = %#x\n", jd->sys.direction_union);
+       printf("put_in_progress = %#x\n", put_in_progress);
+      }
+
       if ((jd->sys.direction_union & GCJD_DMA_PUT)
          && (put_in_progress & PBI_MASK(pbi))){
 
+       if (0){
+         printf("pj:  waiting for tag_mask 0x%08x\n", 1 << put_tag);
+
+       }
+
        mfc_write_tag_mask(1 << put_tag);       // the tag we're interested in
        mfc_read_tag_status_all();              // wait for DMA to complete
        put_in_progress &= ~(PBI_MASK(pbi));





reply via email to

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