This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][NFC] Add a couple of TODOs to the runtime
Needs ReviewPublic

Authored by jdoerfert on Dec 29 2019, 11:15 PM.

Details

Summary

The runtime contains various cases of functions and variables/members
hat are not used or which seem to be overly complicated. This patch
points two such cases out so we can remove them later on (with the
appropriate changes in the code generation).

Diff Detail

Event Timeline

jdoerfert created this revision.Dec 29 2019, 11:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2019, 11:15 PM

Unit tests: pass. 61134 tests passed, 0 failed and 728 were skipped.

clang-tidy: fail. Please fix clang-tidy findings.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

openmp/runtime/src/kmp.h
2122

This does look strange.

Am I right in thinking that the two instances of the union are both used, one for the priority field and the other used for the destructors field? I haven't checked the corresponding codegen in clang.

jdoerfert marked an inline comment as done.Dec 30 2019, 9:36 AM

I'll look into how much work versioning for this type is, especially after we do not expose it to the frontends anymore.

openmp/runtime/src/kmp.h
2122

That is basically how I understand this as well. None, one, or both can be used, depending if you have a priority and/or destructors.

openmp/runtime/src/kmp.h
2245

It's at least used by OMPT to identify an undeferred task.
Ignoring undeferred tasks can be performance critical for tools.

jdoerfert marked an inline comment as done.Jan 14 2020, 11:00 AM
jdoerfert added inline comments.
openmp/runtime/src/kmp.h
2245

I think it is only written here:

// Detachable tasks are not proxy tasks yet but could be in the future. Doing 
// the tasking setup
// when that happens is too late.
if (flags->proxy == TASK_PROXY || flags->detachable == TASK_DETACHABLE) {
  if (flags->proxy == TASK_PROXY) {
    flags->tiedness = TASK_UNTIED;
    flags->merged_if0 = 1;                                                                                                                                                                                                          
  }

Couldn't you use the above conditions to replace merged_if0 ?

The value merged_if0 is initialized in __kmp_task_alloc from the flags argument:
https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp_tasking.cpp#L1287

openmp/runtime/src/kmp.h
2245

Ok, I checked the OMPT code again. The flag is actually used to signal ompt_task_mergeable. So I agree, we can remove this flag from my perspective.