diff --git a/loopy/kernel/instruction.py b/loopy/kernel/instruction.py index 464bfc926ebfaab61cb0defd95b7e8264866f146..9d95408acc7f1a53f1f1a7616f7d6611249c796b 100644 --- a/loopy/kernel/instruction.py +++ b/loopy/kernel/instruction.py @@ -607,26 +607,6 @@ class VarAtomicity(object): return not self.__eq__(other) -class AtomicInit(VarAtomicity): - """Describes initialization of an atomic variable. A subclass of - :class:`VarAtomicity`. - """ - - def update_persistent_hash(self, key_hash, key_builder): - """Custom hash computation function for use with - :class:`pytools.persistent_dict.PersistentDict`. - """ - - super(AtomicInit, self).update_persistent_hash(key_hash, key_builder) - key_builder.rec(key_hash, "AtomicInit") - - def __str__(self): - return "update[%s]%s/%s" % ( - self.var_name, - memory_ordering.to_string(self.ordering), - memory_scope.to_string(self.scope)) - - class OrderedAtomic(VarAtomicity): """Properties of an atomic operation. A subclass of :class:`VarAtomicity`. @@ -665,8 +645,23 @@ class OrderedAtomic(VarAtomicity): memory_scope.to_string(self.scope)) +class AtomicInit(OrderedAtomic): + """Describes initialization of an atomic variable. A subclass of + :class:`OrderedAtomic`. + + .. attribute:: ordering + + One of the values from :class:`memory_ordering` + + .. attribute:: scope + + One of the values from :class:`memory_scope` + """ + op_name = 'init' + + class AtomicUpdate(OrderedAtomic): - """Properties of an atomic update. A subclass of :class:`VarAtomicity`. + """Properties of an atomic update. A subclass of :class:`OrderedAtomic`. .. attribute:: ordering @@ -680,7 +675,7 @@ class AtomicUpdate(OrderedAtomic): class AtomicLoad(OrderedAtomic): - """Properties of an atomic load. A subclass of :class:`VarAtomicity`. + """Properties of an atomic load. A subclass of :class:`OrderedAtomic`. .. attribute:: ordering diff --git a/test/test_loopy.py b/test/test_loopy.py index db18b2a218b653019ac04413d73492766eb850fc..e36a4c2c3cb3f7e70a5b039ea631bbce20923be8 100644 --- a/test/test_loopy.py +++ b/test/test_loopy.py @@ -1129,7 +1129,7 @@ def test_atomic_init(dtype): ], silenced_warnings=["write_race(init)"]) knl = lp.split_iname(knl, 'i', vec_width, inner_tag='l.0') - + print(knl) print(lp.generate_code_v2(knl).device_code())