Skip to content
Snippets Groups Projects
Commit df283e9b authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Merge branch 'fix-pyopencl-get-hl-code' into 'master'

Fix PyOpenCLKernelExecutor.get_code to adequately preprocess arg_to_dtype so…

See merge request !125
parents 282abebe 6873784a
No related branches found
No related tags found
1 merge request!125Fix PyOpenCLKernelExecutor.get_code to adequately preprocess arg_to_dtype so…
Pipeline #
...@@ -25,6 +25,7 @@ THE SOFTWARE. ...@@ -25,6 +25,7 @@ THE SOFTWARE.
import six import six
from six.moves import range, zip from six.moves import range, zip
import numpy as np
from pytools import ImmutableRecord, memoize_method from pytools import ImmutableRecord, memoize_method
from loopy.diagnostic import ParameterFinderWarning from loopy.diagnostic import ParameterFinderWarning
from pytools.py_codegen import ( from pytools.py_codegen import (
...@@ -686,8 +687,17 @@ class PyOpenCLKernelExecutor(KernelExecutorBase): ...@@ -686,8 +687,17 @@ class PyOpenCLKernelExecutor(KernelExecutorBase):
# {{{ debugging aids # {{{ debugging aids
def get_code(self, arg_to_dtype=None): def get_code(self, arg_to_dtype=None):
def process_dtype(dtype):
if isinstance(dtype, type) and issubclass(dtype, np.generic):
dtype = np.dtype(dtype)
if isinstance(dtype, np.dtype):
dtype = NumpyType(dtype, self.kernel.target)
return dtype
if arg_to_dtype is not None: if arg_to_dtype is not None:
arg_to_dtype = frozenset(six.iteritems(arg_to_dtype)) arg_to_dtype = frozenset(
(k, process_dtype(v)) for k, v in six.iteritems(arg_to_dtype))
kernel = self.get_typed_and_scheduled_kernel(arg_to_dtype) kernel = self.get_typed_and_scheduled_kernel(arg_to_dtype)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment