diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 65132c1744d828ab274d58a462779c98c80a7991..50cdd95431ffb2ecfd310aad231b8af586f66ab7 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -2041,6 +2041,7 @@ def fsvm_empty_like(ctx, ary, alignment=None): _KERNEL_ARG_CLASSES = ( MemoryObjectHolder, Sampler, + CommandQueue, LocalMemory, ) if get_cl_header_version() >= (2, 0): diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp index 425bf1d659ec344e40d6af974f56dc3af63dd4cb..bdd2479629dc4d5bf939b3baa2b6fdfe02c7e657 100644 --- a/src/wrap_cl.hpp +++ b/src/wrap_cl.hpp @@ -4215,6 +4215,13 @@ namespace pyopencl (m_kernel, arg_index, sizeof(cl_sampler), &s)); } + void set_arg_command_queue(cl_uint arg_index, command_queue const &queue) + { + cl_command_queue q = queue.data(); + PYOPENCL_CALL_GUARDED(clSetKernelArg, + (m_kernel, arg_index, sizeof(cl_command_queue), &q)); + } + void set_arg_buf(cl_uint arg_index, py::object py_buffer) { const void *buf; @@ -4295,6 +4302,13 @@ namespace pyopencl } catch (py::cast_error &) { } + try + { + set_arg_command_queue(arg_index, arg.cast()); + return; + } + catch (py::cast_error &) { } + set_arg_buf(arg_index, arg); }