Page MenuHomePhabricator

Fix for OMP doacross implementation on Power
ClosedPublic

Authored by Hahnfeld on Nov 17 2017, 7:09 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

Hahnfeld created this revision.Nov 17 2017, 7:09 AM
Hahnfeld added inline comments.Nov 17 2017, 7:12 AM
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

ARM should have the same problem AFAIK

Hahnfeld updated this revision to Diff 123935.Nov 22 2017, 6:52 AM
Hahnfeld marked an inline comment as done.
Hahnfeld edited the summary of this revision. (Show Details)

Add KMP_MB() in __kmpc_doacross_post after discussion with @AlexEichenberger.

AlexEichenberger accepted this revision.Nov 22 2017, 8:06 AM

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)

This revision is now accepted and ready to land.Nov 22 2017, 8:06 AM
This revision was automatically updated to reflect the committed changes.