missing fences in CkLoop implementation
Reported by Sameer Kumar, CkLoop reportFinished() needs a write fence to guarantee that results are visible to the thread that made a sync call to CkLoop (i.e., is waiting for results). Also missing read fence in isFree(). waitLoopDone seems OK because of the locks.
#1 Updated by Phil Miller 7 months ago
- Target version changed from 6.8.0 to 6.9.0
The group discussed this in core at some point. The code is apparently fine on x86 with its strict memory ordering semantics. Post 6.8, we'll switch to using native C++11 atomics to portably address these issues in full.
#9 Updated by Seonmyeong Bak about 1 month ago
For memory fences, we use CmiMemoryReadFence() which calls __sync_synchronize()
Maybe less costly fences for 'acquire' in relaxed consistency model are enough for CmiMemoryReadFence() to prevent reordering of loads/stores within the same thread.
__atomic_thread_fence in gcc builtins with specific memory ordering can replace __sync_synchronize.