From e91983371498cfd87d3f4673d6e5874c9ba03ab9 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 15 Apr 2012 13:56:10 -0700 Subject: volk: work on template stuff --- volk/gen/volk_machine_defs.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 volk/gen/volk_machine_defs.py (limited to 'volk/gen/volk_machine_defs.py') diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py new file mode 100644 index 000000000..e69de29bb -- cgit From eccc86fbb8aa0392307bfdf1bd802e4394868334 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 15 Apr 2012 15:38:14 -0700 Subject: volk: added kernel defs and typedefs --- volk/gen/volk_machine_defs.py | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'volk/gen/volk_machine_defs.py') diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py index e69de29bb..1c879cd50 100644 --- a/volk/gen/volk_machine_defs.py +++ b/volk/gen/volk_machine_defs.py @@ -0,0 +1,70 @@ +# +# Copyright 2012 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_arch_defs import arch_dict + +machines = list() +machine_dict = dict() + +class machine_class: + def __init__(self, name, archs): + self.name = name + self.archs = list() + for arch_name in archs: + if not arch_name: continue + arch = arch_dict[arch_name] + self.archs.append(arch) + arch_name += '_u' + if arch.alignment > 1 and arch_dict.has_key(arch_name): + arch = arch_dict[arch_name] + self.archs.append(arch) + + def __repr__(self): return self.name + +def register_machine(name, archs): + for i, arch_name in enumerate(archs): + if '|' in arch_name: #handle special arch names with the '|' + for arch_sub in arch_name.split('|'): + register_machine(name, archs[:i] + [arch_sub] + archs[i+1:]) + return + machine = machine_class(name=name, archs=archs) + machines.append(machine) + machine_dict[machine.name] = machine + +######################################################################## +# register the machines +######################################################################## +#TODO skip the XML and put it here +from xml.dom import minidom +import os +gendir = os.path.dirname(__file__) +machines_xml = minidom.parse(os.path.join(gendir, 'machines.xml')).getElementsByTagName('machine') +for machine_xml in machines_xml: + kwargs = dict() + for attr in machine_xml.attributes.keys(): + kwargs[attr] = machine_xml.attributes[attr].value + for node in machine_xml.childNodes: + try: + name = node.tagName + val = machine_xml.getElementsByTagName(name)[0].firstChild.data + kwargs[name] = val + except: pass + kwargs['archs'] = kwargs['archs'].split() + register_machine(**kwargs) + +if __name__ == '__main__': + print machines -- cgit From 95e91b44d2ef3535129c0a402c51bc56cfd74d06 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 15 Apr 2012 17:32:38 -0700 Subject: volk: created other templates for runtime + machines --- volk/gen/volk_machine_defs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'volk/gen/volk_machine_defs.py') diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py index 1c879cd50..82734679c 100644 --- a/volk/gen/volk_machine_defs.py +++ b/volk/gen/volk_machine_defs.py @@ -32,6 +32,7 @@ class machine_class: if arch.alignment > 1 and arch_dict.has_key(arch_name): arch = arch_dict[arch_name] self.archs.append(arch) + self.alignment = max(map(lambda a: a.alignment, self.archs)) def __repr__(self): return self.name @@ -39,7 +40,7 @@ def register_machine(name, archs): for i, arch_name in enumerate(archs): if '|' in arch_name: #handle special arch names with the '|' for arch_sub in arch_name.split('|'): - register_machine(name, archs[:i] + [arch_sub] + archs[i+1:]) + register_machine(name+'_'+arch_sub, archs[:i] + [arch_sub] + archs[i+1:]) return machine = machine_class(name=name, archs=archs) machines.append(machine) -- cgit From 3af0f815ae3442dacdac78acf238b277f472c404 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 16 Apr 2012 00:29:26 -0700 Subject: volk: added compile utils and cleanup cmakelists --- volk/gen/volk_machine_defs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'volk/gen/volk_machine_defs.py') diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py index 82734679c..b30a480ba 100644 --- a/volk/gen/volk_machine_defs.py +++ b/volk/gen/volk_machine_defs.py @@ -24,10 +24,12 @@ class machine_class: def __init__(self, name, archs): self.name = name self.archs = list() + self.arch_names = list() for arch_name in archs: if not arch_name: continue arch = arch_dict[arch_name] self.archs.append(arch) + self.arch_names.append(arch_name) arch_name += '_u' if arch.alignment > 1 and arch_dict.has_key(arch_name): arch = arch_dict[arch_name] @@ -40,7 +42,10 @@ def register_machine(name, archs): for i, arch_name in enumerate(archs): if '|' in arch_name: #handle special arch names with the '|' for arch_sub in arch_name.split('|'): - register_machine(name+'_'+arch_sub, archs[:i] + [arch_sub] + archs[i+1:]) + if arch_sub: + register_machine(name+'_'+arch_sub, archs[:i] + [arch_sub] + archs[i+1:]) + else: + register_machine(name, archs[:i] + archs[i+1:]) return machine = machine_class(name=name, archs=archs) machines.append(machine) -- cgit From 25a3690954d80819fe59e179e4675c5cdf81a347 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 16 Apr 2012 00:41:16 -0700 Subject: volk: make orc a normal arch with overrule --- volk/gen/volk_machine_defs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/gen/volk_machine_defs.py') diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py index b30a480ba..77ebe64f0 100644 --- a/volk/gen/volk_machine_defs.py +++ b/volk/gen/volk_machine_defs.py @@ -69,7 +69,7 @@ for machine_xml in machines_xml: val = machine_xml.getElementsByTagName(name)[0].firstChild.data kwargs[name] = val except: pass - kwargs['archs'] = kwargs['archs'].split() + kwargs['archs'] = kwargs['archs'].split() + ['orc|norc'] register_machine(**kwargs) if __name__ == '__main__': -- cgit From c1348c8cdc8d607a00f2c427e0bdf78c80e836d1 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 17 Apr 2012 11:44:49 -0700 Subject: volk: remove norc, implement machine overrule --- volk/gen/volk_machine_defs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'volk/gen/volk_machine_defs.py') diff --git a/volk/gen/volk_machine_defs.py b/volk/gen/volk_machine_defs.py index 77ebe64f0..b30a480ba 100644 --- a/volk/gen/volk_machine_defs.py +++ b/volk/gen/volk_machine_defs.py @@ -69,7 +69,7 @@ for machine_xml in machines_xml: val = machine_xml.getElementsByTagName(name)[0].firstChild.data kwargs[name] = val except: pass - kwargs['archs'] = kwargs['archs'].split() + ['orc|norc'] + kwargs['archs'] = kwargs['archs'].split() register_machine(**kwargs) if __name__ == '__main__': -- cgit