summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Foster2011-02-15 21:59:19 -0800
committerNick Foster2011-02-15 21:59:19 -0800
commitfd03c0ee7cb9af71a5e0292569b626ba3dabd885 (patch)
treeb235723bd39c18e1168a7a100e7e97b1ebf9de14
parentd364316fa2e047890af09c7bdeed776d6391b3db (diff)
downloadgnuradio-fd03c0ee7cb9af71a5e0292569b626ba3dabd885.tar.gz
gnuradio-fd03c0ee7cb9af71a5e0292569b626ba3dabd885.tar.bz2
gnuradio-fd03c0ee7cb9af71a5e0292569b626ba3dabd885.zip
Moved the fn indices gen from volk.c to volk_registry.h so the qa code has access to the static stuff
-rw-r--r--volk/include/volk/make_c.py18
-rw-r--r--volk/include/volk/make_registry.py23
-rwxr-xr-xvolk/include/volk/volk_register.py2
-rw-r--r--volk/lib/qa_utils.cc50
-rw-r--r--volk/lib/qa_utils.h4
5 files changed, 33 insertions, 64 deletions
diff --git a/volk/include/volk/make_c.py b/volk/include/volk/make_c.py
index 6e75067d0..f845ce7d4 100644
--- a/volk/include/volk/make_c.py
+++ b/volk/include/volk/make_c.py
@@ -43,24 +43,6 @@ def make_c(funclist, taglist, arched_arglist, retlist, my_arglist, fcountlist) :
lindex = tempstring.rfind(",");
tempstring = tempstring[0:lindex] + string.replace(tempstring[lindex:len(tempstring)], ",", "");
tempstring = tempstring + "};\n\n";
-
- tempstring = tempstring + "static const char* " + funclist[i] + "_indices[] = {\n";
-
- tags_counter = 0;
- for arch_list in fcountlist[i]:
- tempstring = tempstring + "#if LV_HAVE_"
- for ind in range(len(arch_list)):
-
- tempstring = tempstring + arch_list[ind];
- if ind < len(arch_list) - 1:
- tempstring = tempstring + " && LV_HAVE_";
-
- tempstring = tempstring + "\n \"" + str(taglist[i][tags_counter]) + "\",\n#endif\n";
- tags_counter = tags_counter + 1;
-
- lindex = tempstring.rfind(",");
- tempstring = tempstring[0:lindex] + string.replace(tempstring[lindex:len(tempstring)], ",", "");
- tempstring = tempstring + "};\n\n";
tempstring = tempstring + retlist[i] + "inline " + funclist[i] + "_manual" + arched_arglist[i] + '\n';
tempstring = tempstring + "return " + funclist[i] + "_archs[volk_get_index(" + funclist[i] + "_indices, arch, " + funclist[i] + "_arch_defs)](" + my_arglist[i] + ");" + "\n}\n";
diff --git a/volk/include/volk/make_registry.py b/volk/include/volk/make_registry.py
index 8457d61f3..2bc8bda28 100644
--- a/volk/include/volk/make_registry.py
+++ b/volk/include/volk/make_registry.py
@@ -2,7 +2,7 @@ from xml.dom import minidom
from emit_omnilog import *
import string
-def make_registry(dom, funclist, fcountlist) :
+def make_registry(dom, funclist, fcountlist, taglist) :
tempstring = "";
tempstring = tempstring + "/*this file is auto_generated by volk_register.py*/\n\n";
tempstring = tempstring +'\n#ifndef INCLUDED_VOLK_REGISTRY_H';
@@ -24,6 +24,27 @@ def make_registry(dom, funclist, fcountlist) :
tempstring = tempstring +"#endif /*LV_HAVE_" + arch.swapcase() + "*/\n\n";
counter = 0;
+
+ for i in range(len(funclist)):
+ tempstring = tempstring + "static const char* " + funclist[i] + "_indices[] = {\n";
+
+ tags_counter = 0;
+ for arch_list in fcountlist[i]:
+ tempstring = tempstring + "#if LV_HAVE_"
+ for ind in range(len(arch_list)):
+
+ tempstring = tempstring + arch_list[ind];
+ if ind < len(arch_list) - 1:
+ tempstring = tempstring + " && LV_HAVE_";
+
+ tempstring = tempstring + "\n \"" + str(taglist[i][tags_counter]) + "\",\n#endif\n";
+ tags_counter = tags_counter + 1;
+
+ lindex = tempstring.rfind(",");
+ tempstring = tempstring[0:lindex] + string.replace(tempstring[lindex:len(tempstring)], ",", "");
+ tempstring = tempstring + "};\n\n";
+
+
for fcount in fcountlist:
tempstring = tempstring + "static const int " + funclist[counter] + "_arch_defs[] = {\n";
counter = counter + 1;
diff --git a/volk/include/volk/volk_register.py b/volk/include/volk/volk_register.py
index 242a8dee7..77290f12a 100755
--- a/volk/include/volk/volk_register.py
+++ b/volk/include/volk/volk_register.py
@@ -229,7 +229,7 @@ outfile_set_simd.close();
outfile_config_in.write(make_config_in(filearchs));
outfile_config_in.close();
-outfile_reg.write(make_registry(filearchs, functions, fcountlist));
+outfile_reg.write(make_registry(filearchs, functions, fcountlist, taglist));
outfile_reg.close();
outfile_h.write(make_h(functions, arched_arglist, retlist));
diff --git a/volk/lib/qa_utils.cc b/volk/lib/qa_utils.cc
index e85e2c1bc..150cef729 100644
--- a/volk/lib/qa_utils.cc
+++ b/volk/lib/qa_utils.cc
@@ -12,6 +12,7 @@
//#include <volk/volk_runtime.h>
#include <volk/volk_registry.h>
#include <volk/volk.h>
+#include <volk/volk_cpu.h>
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits.hpp>
@@ -77,49 +78,14 @@ void make_buffer_for_signature(std::vector<void *> &buffs, std::vector<volk_type
}
}
-static std::vector<std::string> get_arch_list(const int archs[]) {
+static std::vector<std::string> get_arch_list(const char **indices, const int archs[]) {
std::vector<std::string> archlist;
int num_archs = archs[0];
-
- //there has got to be a way to query these arches
+
for(int i = 0; i < num_archs; i++) {
- switch(archs[i+1]) {
- case (1<<LV_GENERIC):
- archlist.push_back("generic");
- break;
- case (1<<LV_ORC):
- archlist.push_back("orc");
- break;
- case (1<<LV_SSE):
- archlist.push_back("sse");
- break;
- case (1<<LV_SSE2):
- archlist.push_back("sse2");
- break;
- case (1<<LV_SSE3):
- archlist.push_back("sse3");
- break;
- case (1<<LV_SSSE3):
- archlist.push_back("ssse3");
- break;
- case (1<<LV_SSE4_1):
- archlist.push_back("sse4_1");
- break;
- case (1<<LV_SSE4_2):
- archlist.push_back("sse4_2");
- break;
- case (1<<LV_SSE4_A):
- archlist.push_back("sse4_a");
- break;
- case (1<<LV_MMX):
- archlist.push_back("mmx");
- break;
- case (1<<LV_AVX):
- archlist.push_back("avx");
- break;
- default:
- break;
- }
+ //std::cout << "the archs this fn is avail on is " << archs[0] << std::endl;
+ if(!(archs[i+1] & volk_get_lvarch())) continue; //this arch isn't available on this pc
+ archlist.push_back(std::string(indices[i]));
}
return archlist;
}
@@ -282,11 +248,11 @@ bool icompare(t *in1, t *in2, unsigned int vlen, unsigned int tol) {
return fail;
}
-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(const char **indices, const int archs[], 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(archs);
+ std::vector<std::string> arch_list = get_arch_list(indices, archs);
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 e2539060a..503beb419 100644
--- a/volk/lib/qa_utils.h
+++ b/volk/lib/qa_utils.h
@@ -18,9 +18,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 int[], void(*)(), std::string, float, float, int, int);
+bool run_volk_tests(const char **, const int[], void(*)(), std::string, float, float, int, int);
-#define VOLK_RUN_TESTS(func, tol, scalar, len, iter) BOOST_CHECK_EQUAL(run_volk_tests(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##_indices, func##_arch_defs, (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*);