summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Foster2011-04-16 10:47:10 -0700
committerNick Foster2011-04-16 10:47:10 -0700
commit668da8bd8874ae71a819d55f046e39c964a4270b (patch)
tree421c535410cfaa5193859b2fef035e655208b5a1
parent8b04d29221719239b52a300a338513f05746ed7f (diff)
downloadgnuradio-668da8bd8874ae71a819d55f046e39c964a4270b.tar.gz
gnuradio-668da8bd8874ae71a819d55f046e39c964a4270b.tar.bz2
gnuradio-668da8bd8874ae71a819d55f046e39c964a4270b.zip
Volk: manual funcs implemented, QA code runs. Barfs due to missing Orc arch.
-rw-r--r--volk/include/volk/make_c.py20
-rw-r--r--volk/include/volk/make_each_machine_c.py2
-rw-r--r--volk/include/volk/make_h.py7
-rwxr-xr-xvolk/include/volk/volk_register.py2
-rw-r--r--volk/lib/qa_utils.cc14
-rw-r--r--volk/lib/qa_utils.h6
6 files changed, 32 insertions, 19 deletions
diff --git a/volk/include/volk/make_c.py b/volk/include/volk/make_c.py
index 1129285bb..ee9526860 100644
--- a/volk/include/volk/make_c.py
+++ b/volk/include/volk/make_c.py
@@ -36,6 +36,7 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist):
#include "volk_rank_archs.h"
#include <volk/volk.h>
#include <stdio.h>
+#include <string.h>
"""
tempstring += emit_prolog();
@@ -68,11 +69,15 @@ struct volk_machine *get_machine(void) {
}
}
-static unsigned int get_index(const char **indices, char *arch_name) {
-
-
-
-
+static unsigned int get_index(const char *indices[], unsigned int n_archs, const char *arch_name) {
+ int i;
+ for(i=0; i<n_archs; i++) {
+ if(!strncmp(indices[i], arch_name, 20)) {
+ return i;
+ }
+ }
+ //something terrible should happen here
+ return 0; //but we'll fake it for now
}
"""
@@ -82,7 +87,10 @@ static unsigned int get_index(const char **indices, char *arch_name) {
tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_desc.arch_defs, get_machine()->%s_desc.n_archs, volk_get_lvarch())];\n" % (functions[i], functions[i], functions[i], functions[i])
tempstring += " %s(%s);\n}\n\n" % (functions[i], my_arglist[i])
tempstring += replace_volk.sub("p", functions[i]) + " " + functions[i] + " = &get_" + functions[i] + ";\n\n"
-
+ tempstring += "void %s_manual%s\n" % (functions[i], arched_arglist[i])
+ tempstring += " get_machine()->%s_archs[get_index(get_machine()->%s_desc.indices, get_machine()->%s_desc.n_archs, arch)](%s);\n}\n" % (functions[i], functions[i], functions[i], my_arglist[i])
+ tempstring += "struct volk_func_desc %s_get_func_desc(void) {\n" % (functions[i])
+ tempstring += " return get_machine()->%s_desc;\n}\n" % (functions[i])
tempstring += emit_epilog();
diff --git a/volk/include/volk/make_each_machine_c.py b/volk/include/volk/make_each_machine_c.py
index 11f669566..2b0bf1f48 100644
--- a/volk/include/volk/make_each_machine_c.py
+++ b/volk/include/volk/make_each_machine_c.py
@@ -77,7 +77,7 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist):
tempstring = strip_trailing(tempstring, ",")
tempstring += "};\n"
tempstring += emit_epilog();
-
+
return tempstring
diff --git a/volk/include/volk/make_h.py b/volk/include/volk/make_h.py
index b235cd657..bf449719d 100644
--- a/volk/include/volk/make_h.py
+++ b/volk/include/volk/make_h.py
@@ -4,7 +4,7 @@ from volk_regexp import *
-def make_h(funclist) :
+def make_h(funclist, arched_arglist) :
tempstring = "";
tempstring = tempstring + '/*this file is auto generated by make_h.py*/\n';
@@ -18,7 +18,10 @@ def make_h(funclist) :
tempstring = tempstring + '\n';
for i in range(len(funclist)):
- tempstring = tempstring + "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n"
+ tempstring += "extern " + replace_volk.sub("p", funclist[i]) + " " + funclist[i] + ";\n"
+ tempstring += "extern void %s_manual%s;\n" % (funclist[i], arched_arglist[i])
+ tempstring = strip_trailing(tempstring, " {")
+ tempstring += "extern struct volk_func_desc %s_get_func_desc(void);\n" % (funclist[i])
tempstring = tempstring + emit_epilog();
tempstring = tempstring + "#endif /*INCLUDED_VOLK_RUNTIME*/\n";
diff --git a/volk/include/volk/volk_register.py b/volk/include/volk/volk_register.py
index a319e9dad..9b7ca73f9 100755
--- a/volk/include/volk/volk_register.py
+++ b/volk/include/volk/volk_register.py
@@ -281,7 +281,7 @@ outfile_machines_c.close()
outfile_c.write(make_c(machines, archs, functions, arched_arglist, my_arglist))
outfile_c.close()
-outfile_h.write(make_h(functions))
+outfile_h.write(make_h(functions, arched_arglist))
outfile_h.close()
for machine in machines:
diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc
index acf72cfe1..2dee61823 100644
--- a/volk/lib/qa_utils.cc
+++ b/volk/lib/qa_utils.cc
@@ -14,6 +14,7 @@
#include <volk/volk_registry.h>
#include <volk/volk.h>
#include <volk/volk_cpu.h>
+#include <volk/volk_common.h>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits.hpp>
@@ -63,13 +64,12 @@ void load_random_data(void *data, volk_type_t type, unsigned int n) {
}
}
-static std::vector<std::string> get_arch_list(const int archs[]) {
+static std::vector<std::string> get_arch_list(struct volk_func_desc desc) {
std::vector<std::string> archlist;
- int num_archs = archs[0];
- for(int i = 0; i < num_archs; i++) {
- if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
- archlist.push_back(std::string(indices[i]));
+ for(int i = 0; i < desc.n_archs; i++) {
+ //if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
+ archlist.push_back(std::string(desc.indices[i]));
}
return archlist;
@@ -243,11 +243,11 @@ public:
private: std::list<std::vector<char> > _mems;
};
-bool run_volk_tests(const int archs[], void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) {
+bool run_volk_tests(struct volk_func_desc desc, void (*manual_func)(), std::string name, float tol, float scalar, int vlen, int iter) {
std::cout << "RUN_VOLK_TESTS: " << name << std::endl;
//first let's get a list of available architectures for the test
- std::vector<std::string> arch_list = get_arch_list(indices, archs);
+ std::vector<std::string> arch_list = get_arch_list(desc);
if(arch_list.size() < 2) {
std::cout << "no architectures to test" << std::endl;
diff --git a/volk/lib/qa_utils.h b/volk/lib/qa_utils.h
index ed1ab373b..5103589cc 100644
--- a/volk/lib/qa_utils.h
+++ b/volk/lib/qa_utils.h
@@ -3,6 +3,8 @@
#include <cstdlib>
#include <string>
+#include <volk/volk.h>
+#include <volk/volk_common.h>
struct volk_type_t {
bool is_float;
@@ -18,9 +20,9 @@ volk_type_t volk_type_from_string(std::string);
float uniform(void);
void random_floats(float *buf, unsigned n);
-bool run_volk_tests(const char **, const int[], void(*)(), std::string, float, float, int, int);
+bool run_volk_tests(struct volk_func_desc, void(*)(), std::string, float, float, int, int);
-#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) BOOST_CHECK_EQUAL(run_volk_tests(func##_indices, func##_arch_defs, (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter), 0)
+#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) BOOST_CHECK_EQUAL(run_volk_tests(func##_get_func_desc(), (void (*)())func##_manual, std::string(#func), tol, scalar, len, iter), 0)
typedef void (*volk_fn_1arg)(void *, unsigned int, const char*); //one input, operate in place
typedef void (*volk_fn_2arg)(void *, void *, unsigned int, const char*);