diff --git a/loopy/__init__.py b/loopy/__init__.py index 5dab8596f8bdf28b8f12c10fadbdb76ad097ba12..2c822705a2f559a91e10f914113ae157a664f651 100644 --- a/loopy/__init__.py +++ b/loopy/__init__.py @@ -1157,15 +1157,21 @@ class LoopyCCodeMapper(CCodeMapper): arg = self.kernel.arg_dict[expr.aggregate.name] if isinstance(arg, ImageArg): - if arg.dtype != np.float32: - raise NotImplementedError( - "non-float32 images not supported for now") - assert isinstance(expr.index, tuple) - return ("read_imagef(%s, loopy_sampler, (float%d)(%s)).x" + + base_access = ("read_imagef(%s, loopy_sampler, (float%d)(%s))" % (arg.name, arg.dimensions, ", ".join(self.rec(idx, PREC_NONE) for idx in expr.index[::-1]))) + + if arg.dtype == np.float32: + return base_access+".x" + elif arg.dtype == np.float64: + return "as_double(%s.xy)" % base_access + else: + raise NotImplementedError( + "non-floating-point images not supported for now") + else: # ArrayArg index_expr = expr.index