Power has a weak consistency model so we need memory barriers to
make writes (both from runtime and from user code) available for
all threads.
Details
Details
- Reviewers
AndreyChurbanov jlpeyton hbae carlo.bertolli pawosm01 AlexEichenberger - Commits
- rG0c60ce13b214: Merging r318848:
rG221e7bb1fc56: Fix for OMP doacross implementation on Power
rOMP318848: Fix for OMP doacross implementation on Power
rL319057: Merging r318848:
rL318848: Fix for OMP doacross implementation on Power
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
runtime/src/kmp_csupport.cpp | ||
---|---|---|
3813–3823 ↗ | (On Diff #123335) | I'm not really sure if these memory barriers are needed, ie I haven't seen the test fail without them. I put them in because I think that all threads need to see the zeroed memory in flags |
Comment Actions
Changes are correct, a memory barrier is needed between allocating/reseting values to zero and publishing the pointer. That way, another thread see the published pointer only once all of the zeroing is complete.
In other places, an "instruction sync" might be sufficient, but the memory barrier is certainly fine too (though possibly a bit more expensive)