summaryrefslogtreecommitdiff
path: root/volk/include
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2011-04-16 10:47:10 -0700
committerNick Foster <nick@nerdnetworks.org>2011-04-16 10:47:10 -0700
commit668da8bd8874ae71a819d55f046e39c964a4270b (patch)
tree421c535410cfaa5193859b2fef035e655208b5a1 /volk/include
parent8b04d29221719239b52a300a338513f05746ed7f (diff)
Volk: manual funcs implemented, QA code runs. Barfs due to missing Orc arch.
Diffstat (limited to 'volk/include')
-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
4 files changed, 21 insertions, 10 deletions
diff --git a/volk/include/volk/make_c.py b/volk/include/volk/make_c.py
index 1129285bb3..ee95268605 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 11f6695664..2b0bf1f48f 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 b235cd6578..bf449719d6 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 a319e9dada..9b7ca73f9c 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: