From 76d25a69430b53d6f048cec4d16ba089affaf193 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Fri, 21 Apr 2017 21:16:37 -0500 Subject: [PATCH] Generalize argext and segmented reductions to C-like targets --- loopy/library/reduction.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/loopy/library/reduction.py b/loopy/library/reduction.py index 7037de99..f9648bde 100644 --- a/loopy/library/reduction.py +++ b/loopy/library/reduction.py @@ -455,9 +455,9 @@ def parse_reduction_op(name): def reduction_function_mangler(kernel, func_id, arg_dtypes): if isinstance(func_id, ArgExtFunction) and func_id.name == "init": - from loopy.target.opencl import OpenCLTarget - if not isinstance(kernel.target, OpenCLTarget): - raise LoopyError("only OpenCL supported for now") + from loopy.target.opencl import CTarget + if not isinstance(kernel.target, CTarget): + raise LoopyError("%s: only C-like targets supported for now" % func_id) op = func_id.reduction_op @@ -471,9 +471,9 @@ def reduction_function_mangler(kernel, func_id, arg_dtypes): ) elif isinstance(func_id, ArgExtFunction) and func_id.name == "update": - from loopy.target.opencl import OpenCLTarget - if not isinstance(kernel.target, OpenCLTarget): - raise LoopyError("only OpenCL supported for now") + from loopy.target.opencl import CTarget + if not isinstance(kernel.target, CTarget): + raise LoopyError("%s: only C-like targets supported for now" % func_id) op = func_id.reduction_op @@ -491,9 +491,9 @@ def reduction_function_mangler(kernel, func_id, arg_dtypes): ) elif isinstance(func_id, SegmentedFunction) and func_id.name == "init": - from loopy.target.opencl import OpenCLTarget - if not isinstance(kernel.target, OpenCLTarget): - raise LoopyError("only OpenCL supported for now") + from loopy.target.opencl import CTarget + if not isinstance(kernel.target, CTarget): + raise LoopyError("%s: only C-like targets supported for now" % func_id) op = func_id.reduction_op @@ -507,9 +507,9 @@ def reduction_function_mangler(kernel, func_id, arg_dtypes): ) elif isinstance(func_id, SegmentedFunction) and func_id.name == "update": - from loopy.target.opencl import OpenCLTarget - if not isinstance(kernel.target, OpenCLTarget): - raise LoopyError("only OpenCL supported for now") + from loopy.target.opencl import CTarget + if not isinstance(kernel.target, CTarget): + raise LoopyError("%s: only C-like targets supported for now" % func_id) op = func_id.reduction_op -- GitLab