From a5e2d9e5baf869ae961fbb5820447290d6d9c7c8 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Tue, 26 Apr 2011 21:55:48 -0700
Subject: volk: reorganization of generation sources and generated files
All generation sources have been moved to the gen/ subdirectory.
Bootstrap and volk_register.py generate the files into to gen/ subdirectory
in an effort to cleanly separate the static/generated parts of the build tree.
Define top_gendir in Makefile.common, all generated sources listed in Makefile.ams
are prefixed with $(top_gendir) to differentiate them from static in-tree sources.
---
volk/gen/make_c.py | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 100 insertions(+)
create mode 100644 volk/gen/make_c.py
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
new file mode 100644
index 000000000..591e8b64c
--- /dev/null
+++ b/volk/gen/make_c.py
@@ -0,0 +1,100 @@
+#
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This program 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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, see .
+#
+
+from volk_regexp import *
+import string
+from emit_omnilog import *
+
+#ok todo list:
+#put n_archs into the info struct so it doesn't have to be arch_defs[0].
+
+def make_c(machines, archs, functions, arched_arglist, my_arglist):
+ tempstring = r"""
+// This file is automatically generated by make_c.py.
+// Do not edit this file.
+"""
+ tempstring += """
+#include
+#include
+#include
+#include
+#include
+#include "volk_rank_archs.h"
+#include
+#include
+#include
+
+"""
+ tempstring += emit_prolog();
+
+#OK here's the deal. the .h prototypes the functions. the .c impls them as fptrs, can use p_whatever.
+#also .c impls the get_machine call
+#also .c impls the default call for each fn
+
+#here do static fn get arch
+ tempstring += r"""
+struct volk_machine *get_machine(void) {
+ extern struct volk_machine volk_machines[];
+ extern unsigned int n_volk_machines;
+ static struct volk_machine *machine = NULL;
+
+ if(machine != NULL) return machine;
+ else {
+ unsigned int max_score = 0;
+ int i;
+ for(i=0; i max_score) {
+ max_score = volk_machines[i].caps;
+ machine = &(volk_machines[i]);
+ }
+ }
+ }
+ printf("Using Volk machine: %s\n", machine->name);
+ return machine;
+ }
+}
+
+static unsigned int get_index(const char *indices[], unsigned int n_archs, const char *arch_name) {
+ int i;
+ for(i=0; i%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();
+
+ return tempstring
+
+
--
cgit
From 701b1c520865388a4287c6a3f63afb3ce2626cf1 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Thu, 5 May 2011 19:02:03 -0700
Subject: volk: make volk_machines.cc c-safe
Initialize the list of machine structs w/ pointers,
this does not rely on C++ initialization and is smaller.
In addition, rename the file extension to .c so we know its C only.
Interesting note, this also fixes a bug when compiling under MSVC,
the machines list initialization seemed to have problems prior to this change.
---
volk/gen/make_c.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 591e8b64c..5bad910ae 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Free Software Foundation, Inc.
+# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist):
#here do static fn get arch
tempstring += r"""
struct volk_machine *get_machine(void) {
- extern struct volk_machine volk_machines[];
+ extern struct volk_machine *volk_machines[];
extern unsigned int n_volk_machines;
static struct volk_machine *machine = NULL;
@@ -57,10 +57,10 @@ struct volk_machine *get_machine(void) {
unsigned int max_score = 0;
int i;
for(i=0; i max_score) {
- max_score = volk_machines[i].caps;
- machine = &(volk_machines[i]);
+ if(!(volk_machines[i]->caps & (~volk_get_lvarch()))) {
+ if(volk_machines[i]->caps > max_score) {
+ max_score = volk_machines[i]->caps;
+ machine = volk_machines[i];
}
}
}
--
cgit
From f9f3509dabe429953afc30ca7672b167dc4b5523 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Fri, 6 May 2011 11:01:57 -0700
Subject: volk: make volk_machine_xxx.cc c-safe
Initialize each machine struct using C constants,
(rather than relying on C++ to copy objects).
Each machine file is far simpler,
because we know what archs are in a machine,
we can generate exactly the right code.
In addition, rename the file extensions to .c so we know its C only.
---
volk/gen/make_c.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 5bad910ae..65c42d89a 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -85,13 +85,14 @@ static unsigned int get_index(const char *indices[], unsigned int n_archs, const
for i in range(len(functions)):
tempstring += "void get_" + functions[i] + replace_arch.sub("", arched_arglist[i]) + "\n"
- 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 = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_arch_defs, get_machine()->%s_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 += " get_machine()->%s_archs[get_index(get_machine()->%s_indices, get_machine()->%s_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 += " struct volk_func_desc desc = {get_machine()->%s_indices, get_machine()->%s_arch_defs, get_machine()->%s_n_archs};\n" % (functions[i], functions[i], functions[i])
+ tempstring += " return desc;\n}\n"
tempstring += emit_epilog();
--
cgit
From 12413747c90754482582e16c95b551e1b36c6074 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Fri, 6 May 2011 11:25:00 -0700
Subject: volk: removed volk_registry.h, it was superseded by the machines
---
volk/gen/make_c.py | 1 -
1 file changed, 1 deletion(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 65c42d89a..3fe604f39 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -30,7 +30,6 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist):
tempstring += """
#include
#include
-#include
#include
#include
#include "volk_rank_archs.h"
--
cgit
From 5b4c7d27e9d49ab58df1f1d9350dcaf64c60a1ce Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Fri, 6 May 2011 12:41:16 -0700
Subject: volk: top-level common header cleanup
Since we already have a volk_common.h,
moved the attributes, API declaration,
and c-linkage macros into volk_common.h
This change removes volk_attributes.h,
in favor of one common include header.
The implementation headers that require
attributes now include volk_common.h
This change removes the emit_omnilog.py script,
in favor of pre-processor macros in volk_common.h
In addition, extern C is only defined when in C++
and in GCC because non-GCC does not have complex.h
---
volk/gen/make_c.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 3fe604f39..4e67f31ff 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -17,7 +17,6 @@
from volk_regexp import *
import string
-from emit_omnilog import *
#ok todo list:
#put n_archs into the info struct so it doesn't have to be arch_defs[0].
@@ -38,8 +37,7 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist):
#include
"""
- tempstring += emit_prolog();
-
+
#OK here's the deal. the .h prototypes the functions. the .c impls them as fptrs, can use p_whatever.
#also .c impls the get_machine call
#also .c impls the default call for each fn
@@ -93,8 +91,6 @@ static unsigned int get_index(const char *indices[], unsigned int n_archs, const
tempstring += " struct volk_func_desc desc = {get_machine()->%s_indices, get_machine()->%s_arch_defs, get_machine()->%s_n_archs};\n" % (functions[i], functions[i], functions[i])
tempstring += " return desc;\n}\n"
- tempstring += emit_epilog();
-
return tempstring
--
cgit
From b50dbc4498842fecd7f0c6adc22f25726f8d27d3 Mon Sep 17 00:00:00 2001
From: Nick Foster
Date: Wed, 11 May 2011 21:45:03 -0700
Subject: Volk: Profiler is in apps/ now. Added name to function info. Going to
C++-ify the whole thing.
---
volk/gen/make_c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 4e67f31ff..11b614644 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -82,7 +82,7 @@ static unsigned int get_index(const char *indices[], unsigned int n_archs, const
for i in range(len(functions)):
tempstring += "void get_" + functions[i] + replace_arch.sub("", arched_arglist[i]) + "\n"
- tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_arch_defs, get_machine()->%s_n_archs, volk_get_lvarch())];\n" % (functions[i], functions[i], functions[i], functions[i])
+ tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_arch_defs, get_machine()->%s_n_archs, get_machine()->%s_name, volk_get_lvarch())];\n" % (functions[i], 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])
--
cgit
From 30fdc38d20d4e38908059b6e351c550de5741621 Mon Sep 17 00:00:00 2001
From: Nick Foster
Date: Thu, 12 May 2011 14:21:17 -0700
Subject: Volk: profiling works. loads prefs on init. volk_rank_archs looks in
prefs first.
---
volk/gen/make_c.py | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index 11b614644..fa08bbb0e 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -66,23 +66,11 @@ struct volk_machine *get_machine(void) {
}
}
-static unsigned int get_index(const char *indices[], unsigned int n_archs, const char *arch_name) {
- int i;
- for(i=0; i%s_archs[volk_rank_archs(get_machine()->%s_arch_defs, get_machine()->%s_n_archs, get_machine()->%s_name, volk_get_lvarch())];\n" % (functions[i], functions[i], functions[i], functions[i], functions[i])
+ tempstring += " %s = get_machine()->%s_archs[volk_rank_archs(get_machine()->%s_indices, get_machine()->%s_arch_defs, get_machine()->%s_n_archs, get_machine()->%s_name, volk_get_lvarch())];\n" % (functions[i], functions[i], 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])
--
cgit
From 9bfe75fd7c6a7069db2d2a98195faabf6ba248e2 Mon Sep 17 00:00:00 2001
From: Josh Blum
Date: Fri, 13 May 2011 13:58:01 -0700
Subject: volk: do not install library-only headers
---
volk/gen/make_c.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'volk/gen/make_c.py')
diff --git a/volk/gen/make_c.py b/volk/gen/make_c.py
index fa08bbb0e..e946152d0 100644
--- a/volk/gen/make_c.py
+++ b/volk/gen/make_c.py
@@ -28,7 +28,7 @@ def make_c(machines, archs, functions, arched_arglist, my_arglist):
"""
tempstring += """
#include
-#include
+#include "volk_machines.h"
#include
#include
#include "volk_rank_archs.h"
--
cgit