From 8a96085cd5959c604d8687bcb7675ce1ac030895 Mon Sep 17 00:00:00 2001 From: Kaushik Kulkarni <kaushikcfd@gmail.com> Date: Tue, 29 Jun 2021 07:19:12 -0500 Subject: [PATCH] explains argument preprocesssing --- arraycontext/impl/pytato/compile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arraycontext/impl/pytato/compile.py b/arraycontext/impl/pytato/compile.py index 2098208..2eb6cca 100644 --- a/arraycontext/impl/pytato/compile.py +++ b/arraycontext/impl/pytato/compile.py @@ -278,16 +278,20 @@ class CompiledFunction: input_kwargs_to_loopy = {} - # {{{ extract loopy arguments execute the program + # {{{ preprocess args to get arguments (CL buffers) to be fed to the + # loopy program for arg_id, arg in arg_id_to_arg.items(): if np.isscalar(arg): arg = cla.to_device(self.actx.queue, np.array(arg)) elif isinstance(arg, pt.array.DataWrapper): + # got a Datwwrapper => simply gets its data arg = arg.data elif isinstance(arg, cla.Array): + # got a frozen array => do nothing pass elif isinstance(arg, pt.Array): + # got an array expression => evaluate it arg = self.actx.freeze(arg).with_queue(self.actx.queue) else: raise NotImplementedError(type(arg)) -- GitLab