diff --git a/loopy/kernel/data.py b/loopy/kernel/data.py index bdfadceeb6dee8c189662b8bbe297d1a3d9c7d0d..3ee3002b0cacf22cd2c9081cb5d8b3903c7c2dd5 100644 --- a/loopy/kernel/data.py +++ b/loopy/kernel/data.py @@ -266,7 +266,7 @@ class ImageArg(Record): return "" % (self.name, self.dtype) class ValueArg(Record): - def __init__(self, name, dtype=None, approximately=None): + def __init__(self, name, dtype=None, approximately=1000): if dtype is not None: dtype = np.dtype(dtype) @@ -277,7 +277,7 @@ class ValueArg(Record): return "" % (self.name, self.dtype) class ScalarArg(ValueArg): - def __init__(self, name, dtype=None, approximately=None): + def __init__(self, name, dtype=None, approximately=1000): from warnings import warn warn("ScalarArg is a deprecated name of ValueArg", DeprecationWarning, stacklevel=2) diff --git a/loopy/preprocess.py b/loopy/preprocess.py index f67b25e1fe8fb5cfb545d251e39ea046d428938b..85510831176b91d4d8e7de336f4663e7c31c7ee2 100644 --- a/loopy/preprocess.py +++ b/loopy/preprocess.py @@ -115,7 +115,7 @@ def infer_types_of_temporaries(kernel): if failed: if item is first_failure: # this item has failed before, give up. - raise RuntimeError("could not determine type of '%s'" % item) + raise RuntimeError("could not determine type of '%s'" % item.name) if first_failure is None: # remember the first failure for this round through the queue @@ -592,10 +592,14 @@ def limit_boostability(kernel): def get_auto_axis_iname_ranking_by_stride(kernel, insn): from loopy.kernel.data import ImageArg, ValueArg - approximate_arg_values = dict( - (arg.name, arg.approximately) - for arg in kernel.args - if isinstance(arg, ValueArg)) + approximate_arg_values = {} + for arg in kernel.args: + if isinstance(arg, ValueArg): + if arg.approximately is not None: + approximate_arg_values[arg.name] = arg.approximately + else: + raise RuntimeError("No approximate arg value specified for '%s'" + % arg.name) # {{{ find all array accesses in insn