This is an archive of the discontinued LLVM Phabricator instance.

Fix PR30890: Reduction across teams hangs
ClosedPublic

Authored by Hahnfeld on Dec 1 2017, 1:48 PM.

Details

Summary

__kmpc_reduce_nowait() correctly swapped the teams for reductions
in a teams construct. Apply the same logic to __kmpc_reduce() and
__kmpc_reduce_end().

Diff Detail

Repository
rL LLVM

Event Timeline

Hahnfeld created this revision.Dec 1 2017, 1:48 PM
This revision is now accepted and ready to land.Dec 5 2017, 8:36 AM
This revision was automatically updated to reflect the committed changes.
Hahnfeld added inline comments.Dec 5 2017, 10:50 AM
openmp/trunk/runtime/test/misc_bugs/teams-reduction.c
33–34

The compiler only aligns this to 4 byte, the size of one int32_t. This results in a SIGBUS error on Power because the runtime stores a pointer so the memory location needs to be aligned to 8 bytes. I've solved this in rL319811 with

typedef union {
  // The global will be used as pointer, so we need to make sure that the
  // compiler correctly aligns the global...
  void *ptr;
  int32_t data[8];
} kmp_critical_name;

If somebody has a less ugly idea, I'm happy to listen but I didn't want to use compiler dependent alignment directives...