From 4d4ed7cb873d82e985b0d73e3401d040d33f4751 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 23 Sep 2012 10:57:57 -0500 Subject: [PATCH] Make vector images work. --- loopy/codegen/expression.py | 4 ++++ loopy/compiled.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/loopy/codegen/expression.py b/loopy/codegen/expression.py index ee35ba467..cb8839fa6 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 c8337f8b7..563c676d5 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 -- GitLab