diff --git a/pyopencl/array.py b/pyopencl/array.py index 01eaf395bd3d82a9d4e611d89d88f5a69f04ecd0..b43756f9a30d7612a3719a59d9c7937f1208a752 100644 --- a/pyopencl/array.py +++ b/pyopencl/array.py @@ -38,7 +38,6 @@ from pyopencl.compyte.array import ( c_contiguous_strides as _c_contiguous_strides, ArrayFlags as _ArrayFlags, get_common_dtype as _get_common_dtype_base) -from pyopencl.compyte.dtypes import DTypeDict as _DTypeDict from pyopencl.characterize import has_double_support @@ -70,7 +69,7 @@ def _create_vector_types(): from pyopencl.tools import get_or_register_dtype vec.types = {} - vec.type_to_scalar_and_count = _DTypeDict() + vec.type_to_scalar_and_count = {} counts = [2, 3, 4, 8, 16] diff --git a/pyopencl/compyte b/pyopencl/compyte index 2293b43ecfadfd4ea2adc9266c8ec18f2ae0ce11..5d54e1b2b7f28d3e779029ac0b4aa5f957829f23 160000 --- a/pyopencl/compyte +++ b/pyopencl/compyte @@ -1 +1 @@ -Subproject commit 2293b43ecfadfd4ea2adc9266c8ec18f2ae0ce11 +Subproject commit 5d54e1b2b7f28d3e779029ac0b4aa5f957829f23 diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 7119190612ae0bfde19238751005e1ecc88341e5..ebd0724f93c19374bee9336814ae45b8a21a883e 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -38,9 +38,7 @@ import re from pyopencl.compyte.dtypes import ( # noqa get_or_register_dtype, TypeNameNotKnown, - register_dtype, dtype_to_ctype, - dtype_hashable as _dtype_hashable, - dtype_to_key as _dtype_to_key) + register_dtype, dtype_to_ctype) def _register_types(): @@ -500,16 +498,8 @@ class _CDeclList: return result -if _dtype_hashable: - _memoize_match_dtype_to_c_struct = memoize -else: - import json as _json - _memoize_match_dtype_to_c_struct = memoize( - key=lambda device, name, dtype, context=None: - (device, name, _dtype_to_key(dtype), context)) - -@_memoize_match_dtype_to_c_struct +@memoize def match_dtype_to_c_struct(device, name, dtype, context=None): """Return a tuple `(dtype, c_decl)` such that the C struct declaration in `c_decl` and the structure :class:`numpy.dtype` instance `dtype` @@ -657,15 +647,8 @@ def match_dtype_to_c_struct(device, name, dtype, context=None): return dtype, c_decl -if _dtype_hashable: - _memoize_dtype_to_c_struct = memoize -else: - import json as _json # noqa - _memoize_dtype_to_c_struct = memoize( - key=lambda device, dtype: (device, _dtype_to_key(dtype))) - -@_memoize_dtype_to_c_struct +@memoize def dtype_to_c_struct(device, dtype): matched_dtype, c_decl = match_dtype_to_c_struct( device, dtype_to_ctype(dtype), dtype)