Link: Fence the cache on calls to chpl_comm_barrier by ronawho · Pull Request #18802 · chapel-lang/chapel · GitHub
Merge pull request #18802 from ronawho/fence-cache-chpl_comm_barrier
Fence the cache on calls to chpl_comm_barrier
chpl_comm_barrier is a full synchronization point so we need to fence
the cache when hitting it. We speculated this may be needed in
Cray/chapel-private#1406, but didn't think it was actually a problem
since the AllLocalesBarrier that uses this from module code will use
atomics before calling the comm barrier. However, we recently discovered
that this was causing stale values to be read from the cache during
start up in
chpl_setMemFlags. That code has a GET when memlog is
non-empty, but the GET was using a stale cached value from earlier in
locale model init. This mem flag code is surrounded by barriers but
since we weren't fencing on barrier calls before we ran into problems.
Adjust the barrier to fence now to correct this issue.
Some barriers are now calling the cache before the cache_init is done.
This exposed bugs in the cache code to make pre-init operations no-ops
when using non-native thread-local-storage, so work around that here.
Modified Files: M runtime/include/chpl-cache.h