Skip to content

Add concept of atomic load, implement atomic_inits

Nick Curtis requested to merge arghdos/loopy:atomic_load into master

This PR enables atomic loads of variables on the RHS of atomic operations.

The major points of this are:

  1. Create a new base class of OrderedAtomic which handles stringification and holds ordering/scope
  2. Add a new derived class AtomicLoad for atomicity. The AtomicLoad atomicities are populated during the preprocess step (as it's much easier to pull out the depenency names and atomicity candidates once the kernel has begun to be processed rather than out of the parse step of the instruction creation).
  3. If we ever decide to implement CL2 flavored atomics, we'll need to get AtomicLoads to emit an atomic_load operation, however as it stands it's fine as a simple volatile load. The synchronization / correctness aspect is handled by the synchronization barrier checks as with other variables.
  4. Add test of atomic_load in test/test_loopy.py::test_atomic_load
  5. Add atomic_init implementation for opencl / add test in test/test_loopy.py::test_atomic_init -- using CL1 flavor, this can be accomplished by a simple x-change as we do for updates now. If CL2 flavor ever gets implemented, we'd have to use the atomic_init func
Edited by Nick Curtis

Merge request reports