This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][Tool] Update archer to accept new OpenMP 5.1 enum values
ClosedPublic

Authored by protze.joachim on Nov 4 2020, 3:48 AM.

Details

Summary

D90752 adds an extra enum entry for ompt_scope_endpoint_t, which makes the related switch statement incomplete.
Also adding cases for newly added barrier variants.

Diff Detail

Event Timeline

protze.joachim created this revision.Nov 4 2020, 3:48 AM
protze.joachim requested review of this revision.Nov 4 2020, 3:48 AM
jdoerfert added inline comments.Nov 9 2020, 8:20 AM
openmp/tools/archer/ompt-tsan.cpp
670

I don't get these changes. Don't we just silently ignore other endpoint values now? Does it make sense to make it explicit?

protze.joachim added inline comments.Nov 10 2020, 6:37 AM
openmp/tools/archer/ompt-tsan.cpp
558

Keeping the switch here would look like:

switch (endpoint) {
case ompt_scope_begin:
case ompt_scope_beginend:
...
if (endpoint == ompt_scope_begin) break;
[[fallthrough]]
case ompt_scope_end:
...
670

I can go back to the switch statement and list ompt_scope_beginend explicitly. For this callback, ompt_scope_beginend cannot be used according to the OpenMP spec.

What do you think about adding assertions or warnings for the cases that "should not happen"?

openmp/tools/archer/ompt-tsan.cpp
670

can we at least use an assert or warning or something?

protze.joachim edited the summary of this revision. (Show Details)

I acknowledge the advantage of switch statements, in that they will warn on missing cases in the future. So, I went back to the switch statements.

Regarding the assertions for the cases, which should not happen: I think, this should be covered by the OMPT tests. The OMPT tests fail, if such unexpected callback arguments are passed. Archer can just happily ignore these cases and I added comments for this.

jdoerfert accepted this revision.Nov 12 2020, 6:47 AM

LGTM, thanks!

This revision is now accepted and ready to land.Nov 12 2020, 6:47 AM