[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7923 - in gnuradio/branches/developers/eb/gcell-wip/s
From: |
eb |
Subject: |
[Commit-gnuradio] r7923 - in gnuradio/branches/developers/eb/gcell-wip/src/apps: . spu |
Date: |
Tue, 4 Mar 2008 13:06:58 -0700 (MST) |
Author: eb
Date: 2008-03-04 13:06:57 -0700 (Tue, 04 Mar 2008)
New Revision: 7923
Added:
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/benchmark_procs.c
Removed:
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/gcell_benchmark.c
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/apps/benchmark_nop.cc
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/Makefile.am
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-04 19:10:41 UTC (rev 7922)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/Makefile.am
2008-03-04 20:06:57 UTC (rev 7923)
@@ -24,19 +24,18 @@
INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES)
-# list of programs run by "make check" and "make distcheck"
-
TESTS = test_all
+LIBGCELL = $(top_builddir)/src/lib/libgcell.la
+LIBGCELL_QA = $(top_builddir)/src/lib/libgcell-qa.la
+
+
noinst_PROGRAMS = \
test_all \
benchmark_dma \
benchmark_nop
-LIBGCELL = $(top_builddir)/src/lib/libgcell.la
-LIBGCELL_QA = $(top_builddir)/src/lib/libgcell-qa.la
-
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-04 19:10:41 UTC (rev 7922)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_dma.cc
2008-03-04 20:06:57 UTC (rev 7923)
@@ -26,24 +26,57 @@
#include <stdio.h>
#include <boost/scoped_array.hpp>
-static gc_proc_id_t gcp_qa_udelay = GCP_UNKNOWN_PROC;
+// handle to embedded SPU executable that contains benchmark routines
+// (The name of the variable (benchmark_procs) is the name of the spu
executable.)
+extern spe_program_handle_t benchmark_procs;
+static gc_proc_id_t gcp_benchmark_udelay = GCP_UNKNOWN_PROC;
+
+#define BENCHMARK_PUT 0x1
+#define BENCHMARK_GET 0x2
+#define BENCHMARK_GET_PUT (BENCHMARK_PUT|BENCHMARK_GET)
+
+
static void
init_jd(gc_job_desc *jd, unsigned int usecs,
- unsigned char *getbuf, size_t getbuf_len)
+ unsigned char *getbuf, unsigned char *putbuf, size_t buflen,
+ int getput_mask)
{
- jd->proc_id = gcp_qa_udelay;
+ jd->proc_id = gcp_benchmark_udelay;
jd->input.nargs = 1;
jd->input.arg[0].u32 = usecs;
jd->output.nargs = 0;
- jd->eaa.nargs = 1;
- jd->eaa.arg[0].direction = GCJD_DMA_GET;
- jd->eaa.arg[0].ea_addr = ptr_to_ea(getbuf);
- jd->eaa.arg[0].get_size = getbuf_len;
+
+ switch(getput_mask & BENCHMARK_GET_PUT){
+
+ case BENCHMARK_GET:
+ jd->eaa.nargs = 1;
+ jd->eaa.arg[0].direction = GCJD_DMA_GET;
+ jd->eaa.arg[0].ea_addr = ptr_to_ea(getbuf);
+ jd->eaa.arg[0].get_size = buflen;
+ break;
+
+ case BENCHMARK_PUT:
+ jd->eaa.nargs = 1;
+ jd->eaa.arg[0].direction = GCJD_DMA_PUT;
+ jd->eaa.arg[0].ea_addr = ptr_to_ea(putbuf);
+ jd->eaa.arg[0].put_size = buflen;
+ break;
+
+ case BENCHMARK_GET_PUT:
+ jd->eaa.nargs = 2;
+ jd->eaa.arg[0].direction = GCJD_DMA_GET;
+ jd->eaa.arg[0].ea_addr = ptr_to_ea(getbuf);
+ jd->eaa.arg[0].get_size = buflen;
+ jd->eaa.arg[1].direction = GCJD_DMA_PUT;
+ jd->eaa.arg[1].ea_addr = ptr_to_ea(putbuf);
+ jd->eaa.arg[1].put_size = buflen;
+ break;
+ }
}
static void
-run_test(unsigned int nspes, unsigned int usecs, unsigned int dma_size)
+run_test(unsigned int nspes, unsigned int usecs, unsigned int dma_size, int
getput_mask)
{
static const int64_t TOTAL_SIZE_DMA = 20LL << 30;
static const int NJDS = 64;
@@ -56,31 +89,36 @@
unsigned int ci; // current index
bool done[NJDS];
- static const unsigned int GETBUFSIZE = 16 << 20; // 16MB
- static const unsigned int GETBUFMASK = GETBUFSIZE - 1;
- unsigned char *getbuf = new unsigned char[GETBUFSIZE];
+ static const unsigned int BUFSIZE = (32 << 10) * NJDS;
+ static const unsigned int BUFMASK = BUFSIZE - 1;
+ unsigned char *getbuf = new unsigned char[BUFSIZE];
boost::scoped_array<unsigned char> _getbuf(getbuf);
+ unsigned char *putbuf = new unsigned char[BUFSIZE];
+ boost::scoped_array<unsigned char> _putbuf(putbuf);
int gbi = 0;
// touch all pages to force allocation now
- for (unsigned int i = 0; i < GETBUFSIZE; i += 4096)
+ for (unsigned int i = 0; i < BUFSIZE; i += 4096){
getbuf[i] = 0;
+ putbuf[i] = 0;
+ }
gc_jm_options opts;
+ opts.program_handle = &benchmark_procs;
opts.nspes = nspes;
opts.gang_schedule = true;
gc_job_manager *mgr = gc_make_job_manager(&opts);
- if ((gcp_qa_udelay = mgr->lookup_proc("qa_udelay")) == GCP_UNKNOWN_PROC){
- fprintf(stderr, "lookup_proc: failed to find \"qa_udelay\"\n");
+ if ((gcp_benchmark_udelay = mgr->lookup_proc("benchmark_udelay")) ==
GCP_UNKNOWN_PROC){
+ fprintf(stderr, "lookup_proc: failed to find \"benchmark_udelay\"\n");
return;
}
// allocate and init all job descriptors
for (int i = 0; i < NJDS; i++){
all_jds[i] = mgr->alloc_job_desc();
- init_jd(all_jds[i], usecs, &getbuf[gbi], dma_size);
- gbi = (gbi + dma_size) & GETBUFMASK;
+ init_jd(all_jds[i], usecs, &getbuf[gbi], &putbuf[gbi], dma_size,
getput_mask);
+ gbi = (gbi + dma_size) & BUFMASK;
}
for (int iter = 0; iter < 1; iter++){
@@ -159,15 +197,24 @@
return false;
}
+static void
+usage()
+{
+ fprintf(stderr, "usage: benchmark_dma [-p] [-g] [-n <nspes>] [-u <udelay>]
[-s <dma_size>]\n");
+ fprintf(stderr, " you must specify one or both of -p (put) and -g (get)\n");
+}
+
+
int
main(int argc, char **argv)
{
unsigned int nspes = 0;
unsigned int usecs = 0;
- unsigned int dma_size = 16 << 10;
+ unsigned int dma_size = 32 << 10;
+ int getput_mask = 0;
int ch;
- while ((ch = getopt(argc, argv, "n:u:s:")) != EOF){
+ while ((ch = getopt(argc, argv, "n:u:s:pg")) != EOF){
switch(ch){
case 'n':
nspes = strtol(optarg, 0, 0);
@@ -185,13 +232,26 @@
}
break;
+ case 'p':
+ getput_mask |= BENCHMARK_PUT;
+ break;
+
+ case 'g':
+ getput_mask |= BENCHMARK_GET;
+ break;
+
case '?':
default:
- fprintf(stderr, "usage: benchmark_dma [-n <nspes>] [-u <udelay>] [-s
<dma_size>]\n");
+ usage();
return 1;
}
}
- run_test(nspes, usecs, dma_size);
+ if (getput_mask == 0){
+ usage();
+ return 1;
+ }
+
+ run_test(nspes, usecs, dma_size, getput_mask);
return 0;
}
Modified: gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_nop.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_nop.cc
2008-03-04 19:10:41 UTC (rev 7922)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/benchmark_nop.cc
2008-03-04 20:06:57 UTC (rev 7923)
@@ -25,12 +25,16 @@
#include <stdlib.h>
#include <stdio.h>
-static gc_proc_id_t gcp_qa_udelay = GCP_UNKNOWN_PROC;
+// handle to embedded SPU executable that contains benchmark routines
+// (The name of the variable (benchmark_procs) is the name of the spu
executable.)
+extern spe_program_handle_t benchmark_procs;
+static gc_proc_id_t gcp_benchmark_udelay = GCP_UNKNOWN_PROC;
+
static void
init_jd(gc_job_desc *jd, unsigned int usecs)
{
- jd->proc_id = gcp_qa_udelay;
+ jd->proc_id = gcp_benchmark_udelay;
jd->input.nargs = 1;
jd->input.arg[0].u32 = usecs;
jd->output.nargs = 0;
@@ -50,12 +54,13 @@
bool done[NJDS];
gc_jm_options opts;
+ opts.program_handle = &benchmark_procs;
opts.nspes = nspes;
opts.gang_schedule = true;
gc_job_manager *mgr = gc_make_job_manager(&opts);
- if ((gcp_qa_udelay = mgr->lookup_proc("qa_udelay")) == GCP_UNKNOWN_PROC){
- fprintf(stderr, "lookup_proc: failed to find \"qa_udelay\"\n");
+ if ((gcp_benchmark_udelay = mgr->lookup_proc("benchmark_udelay")) ==
GCP_UNKNOWN_PROC){
+ fprintf(stderr, "lookup_proc: failed to find \"benchmark_udelay\"\n");
return;
}
Property changes on: gnuradio/branches/developers/eb/gcell-wip/src/apps/spu
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
*.a
*.la
*.lo
.deps
.libs
test_spu
gcell_spu_main
gcell_qa
gcell_benchmark
+ Makefile
Makefile.in
*.a
*.la
*.lo
.deps
.libs
benchmark_procs
Modified: gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/Makefile.am
2008-03-04 19:10:41 UTC (rev 7922)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/Makefile.am
2008-03-04 20:06:57 UTC (rev 7923)
@@ -27,9 +27,8 @@
# SPU executables
-LDADD = $(LIBGCELL_SPU)
-
noinst_PROGRAMS = \
- gcell_benchmark
+ benchmark_procs
-
+benchmark_procs_SOURCES = benchmark_procs.c
+benchmark_procs_LDADD = $(LIBGCELL_SPU)
Copied:
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/benchmark_procs.c (from
rev 7922,
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/gcell_benchmark.c)
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/benchmark_procs.c
(rev 0)
+++ gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/benchmark_procs.c
2008-03-04 20:06:57 UTC (rev 7923)
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <gc_delay.h>
+#include <gc_declare_proc.h>
+#include <string.h>
+
+#define _UNUSED __attribute__((unused))
+
+
+static void
+benchmark_udelay(const gc_job_direct_args_t *input,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa _UNUSED)
+{
+ gc_udelay(input->arg[0].u32);
+}
+
+GC_DECLARE_PROC(benchmark_udelay, "benchmark_udelay");
+
+
+
+static void
+benchmark_put_zeros(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa)
+{
+ for (unsigned int i = 0; i < eaa->nargs; i++){
+ if (eaa->arg[i].direction == GCJD_DMA_PUT)
+ memset(eaa->arg[i].ls_addr, 0, eaa->arg[i].put_size);
+ }
+}
+
+GC_DECLARE_PROC(benchmark_put_zeros, "benchmark_put_zeros");
+
+
+static void
+benchmark_copy(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output,
+ const gc_job_ea_args_t *eaa)
+{
+ if (eaa->nargs != 2
+ || eaa->arg[0].direction != GCJD_DMA_PUT
+ || eaa->arg[1].direction != GCJD_DMA_GET){
+ output->arg[0].s32 = -1;
+ return;
+ }
+
+ output->arg[0].s32 = 0;
+ unsigned n = eaa->arg[0].put_size;
+ if (eaa->arg[1].get_size < n)
+ n = eaa->arg[1].get_size;
+
+ memcpy(eaa->arg[0].ls_addr, eaa->arg[1].ls_addr, n);
+}
+
+GC_DECLARE_PROC(benchmark_copy, "benchmark_copy");
Deleted:
gnuradio/branches/developers/eb/gcell-wip/src/apps/spu/gcell_benchmark.c
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7923 - in gnuradio/branches/developers/eb/gcell-wip/src/apps: . spu,
eb <=