diff --git a/coffee/__init__.py b/coffee/__init__.py index 63980e08..6fc464df 100644 --- a/coffee/__init__.py +++ b/coffee/__init__.py @@ -36,7 +36,6 @@ import sys from coffee.citations import update_citations -from coffee.vectorizer import VectStrategy from coffee.logger import LOG_DEFAULT, set_log_level, warn from coffee.system import set_architecture, set_compiler, set_isa diff --git a/coffee/base.py b/coffee/base.py index 10cc2c02..bcbe2e87 100644 --- a/coffee/base.py +++ b/coffee/base.py @@ -1339,6 +1339,7 @@ def __init__(self, scope): def __str__(self): return self._scope + LOCAL = Scope("LOCAL") EXTERNAL = Scope("EXTERNAL") BUFFER = Scope("BUFFER") diff --git a/coffee/rewriter.py b/coffee/rewriter.py index a68cec2f..ebb87b9a 100644 --- a/coffee/rewriter.py +++ b/coffee/rewriter.py @@ -562,7 +562,6 @@ def sharing_graph_rewrite(self): # Construct the sharing graph nodes, edges = [], [] - operands = summands(self.stmt.rvalue) for i in summands(self.stmt.rvalue): symbols = zip(*explore_operator(i))[0] if not isinstance(i, Symbol) else [i] lsymbols = [s for s in symbols if any(d in lda[s] for d in linear_dims)] diff --git a/coffee/visitors/utilities.py b/coffee/visitors/utilities.py index c8ba627f..061fea8a 100644 --- a/coffee/visitors/utilities.py +++ b/coffee/visitors/utilities.py @@ -5,11 +5,9 @@ from copy import deepcopy from collections import OrderedDict, defaultdict import numpy as np -import networkx as nx from coffee.visitor import Visitor from coffee.base import Sum, Sub, Prod, Div, ArrayInit, SparseArrayInit -import coffee.utils __all__ = ["ReplaceSymbols", "CheckUniqueness", "Uniquify", "Evaluate", @@ -123,7 +121,8 @@ def __init__(self, decls, track_zeros): import coffee.vectorizer self.up = coffee.vectorizer.vect_roundup self.down = coffee.vectorizer.vect_rounddown - self.make_itspace = coffee.utils.ItSpace + from coffee.utils import ItSpace + self.make_itspace = ItSpace super(Evaluate, self).__init__() def visit_object(self, o, *args, **kwargs): @@ -284,7 +283,9 @@ def default_retval(cls): """ def __init__(self, symbols): + from coffee.utils import flatten self.symbols = symbols + self.flatten = flatten super(ProjectExpansion, self).__init__() def visit_object(self, o, *args, **kwargs): @@ -305,13 +306,13 @@ def visit_Prod(self, o, parent=None, *args, **kwargs): projection = self.default_retval() for n in o.children: projection.extend(self.visit(n, parent=o, *args, **kwargs)) - return [list(coffee.utils.flatten(projection))] + return [list(self.flatten(projection))] else: # Only the top level Prod, in a chain of Prods, should do the # tensor product projection = [self.visit(n, parent=o, *args, **kwargs) for n in o.children] product = itertools.product(*projection) - ret = [list(coffee.utils.flatten(i)) for i in product] or projection + ret = [list(self.flatten(i)) for i in product] or projection return ret def visit_Symbol(self, o, *args, **kwargs): diff --git a/setup.cfg b/setup.cfg index 796c344b..9478c194 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [flake8] ignore = - E501,F403,F405,E226,E265,E731,E402,E266, + E501,F403,F405,E226,E265,E731,E402,E266,F999, FI14,FI54, FI50,FI51,FI53 exclude = .git,,__pycache__,build,dist,doc/source/conf.py diff --git a/tests/test_visitors.py b/tests/test_visitors.py index 5a0e6c1b..a0a6634f 100644 --- a/tests/test_visitors.py +++ b/tests/test_visitors.py @@ -375,9 +375,8 @@ def test_find_coffee_expressions_single(): val = ret[assign] - assert len(val) == 3 + assert len(val) == 2 - assert val[2] == () assert val[1] == [(tree.children[0], tree)] assert val[0] == tree.children[0].children[0] @@ -405,13 +404,11 @@ def test_find_coffee_expressions_nested(): assert val1[0] == tree.children[0].children[0] assert val1[1] == [(tree.children[0], tree)] - assert val1[2] == () assert val2[0] == tree.children[0].body[0].children[0].children[0] assert val2[1] == [(tree.children[0], tree), (tree.children[0].body[0].children[0], tree.children[0].body[0])] - assert val2[2] == ("i", ) def test_symbol_modes_simple():