Cache fixes

Fixes bugs, including fixes removed from NetworkAtomics (whoops). See individual commit messages.
The task counter is not used for synchronization - it's used for determining actions based on how many tasks there are. We're not using the task counter to e.g. guarantee that memory written in another thread is available - we just use it to decide how many tasks to spawn.

memory_order_relaxed doesn't change the atomicity of the task counter - it still gets atomic updates - it just changes whether or not we are requiring an ordering on the other loads/stores through the atomic variable.