Skip to content
Snippets Groups Projects
Commit fb8e9afb authored by Tim Warburton's avatar Tim Warburton
Browse files

Provide better error messages in a few situations.

parent 85194627
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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))
......
......@@ -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])
......
......@@ -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)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment