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

Merge branch 'fix_array_arg_persis_hash' into 'master'

Fix ArrayArg's update_persistent_hash

See merge request inducer/loopy!332
parents 60db6fcd 51917a4b
No related branches found
No related tags found
No related merge requests found
......@@ -385,6 +385,14 @@ class ArrayArg(ArrayBase, KernelArgument):
+
" aspace: %s" % aspace_str)
def update_persistent_hash(self, key_hash, key_builder):
"""Custom hash computation function for use with
:class:`pytools.persistent_dict.PersistentDict`.
"""
super(ArrayArg, self).update_persistent_hash(key_hash, key_builder)
key_builder.rec(key_hash, self.address_space)
key_builder.rec(key_hash, self.is_output_only)
# Making this a function prevents incorrect use in isinstance.
# Note: This is *not* deprecated, as it is super-common and
......
......@@ -3003,6 +3003,18 @@ def test_shape_mismatch_check(ctx_factory):
prg(queue, a=a, b=b)
def test_array_arg_extra_kwargs_persis_hash():
from loopy.tools import LoopyKeyBuilder
a = lp.ArrayArg('a', shape=(10, ), dtype=np.float64,
address_space=lp.AddressSpace.LOCAL)
not_a = lp.ArrayArg('a', shape=(10, ), dtype=np.float64,
address_space=lp.AddressSpace.PRIVATE)
key_builder = LoopyKeyBuilder()
assert key_builder(a) != key_builder(not_a)
if __name__ == "__main__":
if len(sys.argv) > 1:
exec(sys.argv[1])
......
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