From fb8e9afbfbb770250e66e6209bea1231fdf0c134 Mon Sep 17 00:00:00 2001 From: Tim Warburton Date: Tue, 25 Oct 2011 17:42:35 -0500 Subject: [PATCH] Provide better error messages in a few situations. --- MEMO | 2 ++ loopy/__init__.py | 7 +------ loopy/kernel.py | 9 +++++---- loopy/symbolic.py | 5 ++++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/MEMO b/MEMO index 56bc50c2a..1e12de69a 100644 --- a/MEMO +++ b/MEMO @@ -58,6 +58,8 @@ Things to consider TODO ^^^^ +- assert dependencies <= parent_inames in loopy/__init__.py + ??? - FIXME: Deal with insns losing a seq iname dep in a CSE realization diff --git a/loopy/__init__.py b/loopy/__init__.py index 1f73e0409..3c43339a4 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -15,11 +15,6 @@ import numpy as np -# TODO list moved to MEMO in root - - - - class LoopyAdvisory(UserWarning): pass @@ -284,7 +279,7 @@ def realize_cse(kernel, cse_tag, dtype, duplicate_inames=[], parallel_inames=Non # the iname is *not* a dependency of the fetch expression if iname in duplicate_inames: - raise RuntimeError("duplicating an iname ('%s')" + raise RuntimeError("duplicating an iname ('%s') " "that the CSE ('%s') does not depend on " "does not make sense" % (iname, expr.child)) diff --git a/loopy/kernel.py b/loopy/kernel.py index 0ee99b860..cf4219bf1 100644 --- a/loopy/kernel.py +++ b/loopy/kernel.py @@ -625,8 +625,9 @@ class LoopKernel(Record): all_inames_by_insns |= insn.all_inames() if all_inames_by_insns != self.all_inames(): - raise RuntimeError("inames collected from instructions " - "do not match domain inames") + raise RuntimeError("inames collected from instructions (%s) " + "do not match domain inames (%s)" + % (", ".join(all_inames_by_insns), ", ".join(self.all_inames()))) global_sizes = {} local_sizes = {} @@ -676,8 +677,8 @@ class LoopKernel(Record): while cur_axis > len(size_list): from loopy import LoopyAdvisory from warnings import warn - warn("%s axis %d unassigned--assuming length 1" % len(size_list), - LoopyAdvisory) + warn("%s axis %d unassigned--assuming length 1" % ( + which, len(size_list)), LoopyAdvisory) size_list.append(1) size_list.append(size_dict[cur_axis]) diff --git a/loopy/symbolic.py b/loopy/symbolic.py index 725fbad3b..816b60751 100644 --- a/loopy/symbolic.py +++ b/loopy/symbolic.py @@ -336,12 +336,15 @@ class LoopyCCodeMapper(CCodeMapper): ary_strides, index_expr))), enclosing_prec) - if expr.aggregate.name in self.kernel.temporary_variables: + elif expr.aggregate.name in self.kernel.temporary_variables: temp_var = self.kernel.temporary_variables[expr.aggregate.name] return (temp_var.name + "".join("[%s]" % self.rec(idx, PREC_NONE) for idx in expr.index)) + else: + raise RuntimeError("nothing known about variable '%s'" % expr.aggregate.name) + def map_floor_div(self, expr, prec): if isinstance(expr.denominator, int) and expr.denominator > 0: return ("int_floor_div_pos_b(%s, %s)" -- GitLab