diff --git a/loopy/codegen/expression.py b/loopy/codegen/expression.py index ee35ba46796b5a71be1b32e7f21f4e13c3ec73bc..cb8839fa6b6fed255cf897ae6df984c85954aa94 100644 --- a/loopy/codegen/expression.py +++ b/loopy/codegen/expression.py @@ -7,6 +7,8 @@ from pymbolic.mapper.stringifier import (PREC_NONE, PREC_CALL, PREC_PRODUCT, PREC_POWER) from pymbolic.mapper import CombineMapper import islpy as isl +import pyopencl as cl +import pyopencl.array # {{{ type inference @@ -269,6 +271,8 @@ class LoopyCCodeMapper(RecursiveMapper): if arg.dtype == np.float32: return base_access+".x" + if arg.dtype in cl.array.vec.type_to_scalar_and_count: + return base_access elif arg.dtype == np.float64: return "as_double(%s.xy)" % base_access else: diff --git a/loopy/compiled.py b/loopy/compiled.py index c8337f8b705b226a35fb026f896d60a53f0b548a..563c676d5be9faea97ed89328ff23d1001386727 100644 --- a/loopy/compiled.py +++ b/loopy/compiled.py @@ -335,7 +335,7 @@ def make_ref_args(kernel, queue, parameters, fill_rand(storage_array) if isinstance(arg, ImageArg): # must be contiguous - ref_args[arg.name] = cl.image_from_array(queue.context, ary.get(), 1) + ref_args[arg.name] = cl.image_from_array(queue.context, ary.get()) else: ref_args[arg.name] = ary @@ -388,7 +388,7 @@ def make_args(queue, kernel, arg_descriptors, parameters, # must be contiguous args[arg.name] = cl.image_from_array( - queue.context, arg_desc.ref_array.get(), 1) + queue.context, arg_desc.ref_array.get()) elif isinstance(arg, GlobalArg): assert arg.offset == 0