diff --git a/loopy/kernel/data.py b/loopy/kernel/data.py index 8248b4ca993c34010a9e81d1da74483fc0a14d16..bdfadceeb6dee8c189662b8bbe297d1a3d9c7d0d 100644 --- a/loopy/kernel/data.py +++ b/loopy/kernel/data.py @@ -219,12 +219,22 @@ class ShapedArg(Record): @property def dimensions(self): - return len(self.shape) + return len(self.strides) -class GlobalArg(ShapedArg): def __repr__(self): - return "<GlobalArg '%s' of type %s and shape (%s)>" % ( - self.name, self.dtype, ",".join(str(i) for i in self.shape)) + if self.shape is None: + shape = "unknown" + else: + shape = ",".join(str(i) for i in self.shape) + + return "<%s '%s' of type %s and shape (%s)>" % ( + type(self).__name__, self.name, self.dtype, shape) + +class GlobalArg(ShapedArg): + pass + +class ConstantArg(ShapedArg): + pass class ArrayArg(GlobalArg): def __init__(self, *args, **kwargs): @@ -233,11 +243,6 @@ class ArrayArg(GlobalArg): stacklevel=2) GlobalArg.__init__(self, *args, **kwargs) -class ConstantArg(ShapedArg): - def __repr__(self): - return "<ConstantArg '%s' of type %s and shape (%s)>" % ( - self.name, self.dtype, ",".join(str(i) for i in self.shape)) - class ImageArg(Record): def __init__(self, name, dtype=None, dimensions=None, shape=None): dtype = np.dtype(dtype)