This is an archive of the discontinued LLVM Phabricator instance.

GOMP compatibility: add missing OMP4.0 taskdeps handling code
ClosedPublic

Authored by pawosm01 on Mar 17 2017, 4:22 AM.

Details

Summary

This patch adds OpenMP 4.0 task dependencies handling code that is
missing in LLVM libomp's GOMP compatibility layer. The absence of this
code is responsible for weird behaviour of the taskdep benchmarks from
Kastors suite whenever they are compiled using GCC and linked against LLVM libomp
instead of GOMP.

Diff Detail

Repository
rL LLVM

Event Timeline

pawosm01 created this revision.Mar 17 2017, 4:22 AM
AndreyChurbanov requested changes to this revision.Mar 23 2017, 4:02 AM

This change breaks codes compiled by gcc 4.8 or earlier, because it is unsafe to unconditionally read the new parameter that earlier compilers don't provide. Note that new libgomp library works fine with old compilers, so there should probably be some flag (bit in existing gomp_flags) responsible for providing newly added parameter.

This revision now requires changes to proceed.Mar 23 2017, 4:02 AM
Hahnfeld added inline comments.
runtime/src/kmp_gsupport.cpp
923 ↗(On Diff #92124)

priority is probably an OpenMP 4.5 thing?

This comment was removed by pawosm01.
pawosm01 updated this revision to Diff 92784.Mar 23 2017, 5:35 AM
pawosm01 edited edge metadata.

now using gomp_flags

pawosm01 marked an inline comment as done.Mar 23 2017, 5:36 AM
jcownie edited edge metadata.Mar 23 2017, 6:23 AM

Is "dep_list[i].flags.in = 1;" really supposed to be set in both of the if cases (lines 980 and 983)?
If so, can't we lift that out of the if?

Is "dep_list[i].flags.in = 1;" really supposed to be set in both of the if cases (lines 980 and 983)?
If so, can't we lift that out of the if?

Yes and maybe. It must me set to 1 for both due to `KMP_DEBUG_ASSERT(dep->flags.in);` checked for each task dependency processed by __kmp_process_deps() in kmp_taskdeps.cpp. Setting all flags in both branches seemed to me as better expressing my intents, but I can change it if you insist.

AndreyChurbanov accepted this revision.Mar 23 2017, 6:55 AM

LGTM

runtime/src/kmp_gsupport.cpp
923 ↗(On Diff #92124)

Right, the priority is 4.5 addition, and we can add its implementation later if we want to.

This revision is now accepted and ready to land.Mar 23 2017, 6:55 AM

Setting all flags in both branches seemed to me as better expressing my intents, but I can change it if you insist.

I am not going to insist. I just find it odd to have a duplicate line of code, and the fact that it is the same in both if branches made me suspicious that there was bug lurking there. So, personally, I would find code like this clearer.

dep_list[i].len = 0U;
dep_list[i].flags.in = 1;
dep_list[i].flags.out = i<nout;
This revision was automatically updated to reflect the committed changes.

Setting all flags in both branches seemed to me as better expressing my intents, but I can change it if you insist.

I am not going to insist. I just find it odd to have a duplicate line of code, and the fact that it is the same in both if branches made me suspicious that there was bug lurking there. So, personally, I would find code like this clearer.

dep_list[i].len = 0U;
dep_list[i].flags.in = 1;
dep_list[i].flags.out = i<nout;

Yep, that looks better.

Thanks, LGTM.