From 81956ebf81ee739aa4a8768913c240a8cbe3b673 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Tue, 18 Jun 2013 20:30:10 -0400 Subject: [PATCH] PEP8 isl_helpers --- loopy/isl_helpers.py | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/loopy/isl_helpers.py b/loopy/isl_helpers.py index a83564f48..ec18a1b9b 100644 --- a/loopy/isl_helpers.py +++ b/loopy/isl_helpers.py @@ -25,15 +25,10 @@ THE SOFTWARE. """ - - import islpy as isl from islpy import dim_type - - - def block_shift_constraint(cns, type, pos, multiple, as_equality=None): if as_equality != cns.is_equality(): if as_equality: @@ -49,9 +44,6 @@ def block_shift_constraint(cns, type, pos, multiple, as_equality=None): return cns - - - def negate_constraint(cns): assert not cns.is_equality() # FIXME hackety hack @@ -60,15 +52,15 @@ def negate_constraint(cns): my_set = my_set.complement() results = [] + def examine_basic_set(s): s.foreach_constraint(results.append) + my_set.foreach_basic_set(examine_basic_set) result, = results return result - - def make_index_map(set, index_expr): from loopy.symbolic import eq_constraint_from_expr @@ -93,9 +85,6 @@ def make_index_map(set, index_expr): return amap - - - def pw_aff_to_aff(pw_aff): if isinstance(pw_aff, isl.Aff): return pw_aff @@ -118,15 +107,11 @@ def pw_aff_to_aff(pw_aff): return pieces[0][1] - - def dump_space(ls): return " ".join("%s: %d" % (dt, ls.dim(getattr(dim_type, dt))) for dt in dim_type.names) - - def make_slab(space, iname, start, stop): zero = isl.Aff.zero_on_domain(space) @@ -144,8 +129,10 @@ def make_slab(space, iname, start, stop): if isinstance(stop, Expression): stop = aff_from_expr(space, stop) - if isinstance(start, int): start = zero + start - if isinstance(stop, int): stop = zero + stop + if isinstance(start, int): + start = zero + start + if isinstance(stop, int): + stop = zero + stop if isinstance(iname, str): iname_dt, iname_idx = zero.get_space().get_var_dict()[iname] @@ -165,8 +152,6 @@ def make_slab(space, iname, start, stop): return result - - def iname_rel_aff(space, iname, rel, aff): """*aff*'s domain space is allowed to not match *space*.""" @@ -188,8 +173,6 @@ def iname_rel_aff(space, iname, rel, aff): raise ValueError("unknown value of 'rel': %s" % rel) - - def static_extremum_of_pw_aff(pw_aff, constants_only, set_method, what, context): pieces = pw_aff.get_pieces() if len(pieces) == 1: @@ -228,23 +211,21 @@ def static_extremum_of_pw_aff(pw_aff, constants_only, set_method, what, context) % (what, pw_aff)) - - def static_min_of_pw_aff(pw_aff, constants_only, context=None): return static_extremum_of_pw_aff(pw_aff, constants_only, isl.PwAff.ge_set, "minimum", context) + def static_max_of_pw_aff(pw_aff, constants_only, context=None): return static_extremum_of_pw_aff(pw_aff, constants_only, isl.PwAff.le_set, "maximum", context) + def static_value_of_pw_aff(pw_aff, constants_only, context=None): return static_extremum_of_pw_aff(pw_aff, constants_only, isl.PwAff.eq_set, "value", context) - - def duplicate_axes(isl_obj, duplicate_inames, new_inames): if isinstance(isl_obj, list): return [ @@ -293,9 +274,6 @@ def duplicate_axes(isl_obj, duplicate_inames, new_inames): return moved_dims.intersect(more_dims) - - - def is_nonnegative(expr, over_set): space = over_set.get_space() from loopy.symbolic import aff_from_expr @@ -309,8 +287,6 @@ def is_nonnegative(expr, over_set): return over_set.intersect(expr_neg_set).is_empty() - - def convexify(domain): """Try a few ways to get *domain* to be a BasicSet, i.e. explicitly convex. @@ -348,8 +324,6 @@ def convexify(domain): raise NotImplementedError("Could not find convex representation of set") - - def boxify(cache_manager, domain, box_inames, context): var_dict = domain.get_var_dict(dim_type.set) box_iname_indices = [var_dict[iname][1] for iname in box_inames] -- GitLab