Page MenuHomePhabricator

[OpenMP] support alloc of serialized tasks
ClosedPublic

Authored by protze.joachim on Jun 9 2020, 12:55 PM.

Details

Summary

Usually for serialized tasks (with if(0)), __kmpc_omp_task_begin_if0 is used.
This does not allow to track outgoing dependencies in case of detached tasks (see https://bugs.llvm.org/show_bug.cgi?id=46185).
Similarly, mutexinoutset would rather block than execute the task immediately.

This patch will allow to generate code as for normal tasks, but mark the task as undeferrable.

Diff Detail

Event Timeline

protze.joachim created this revision.Jun 9 2020, 12:55 PM

Can we test this?

My proposed tests are attached to the bugzilla issues, but need both codegen fixes and this runtime change.

openmp/runtime/src/kmp_tasking.cpp
1331

The task_serial bit supposed to be used internally by the library, not by compiler (we virtually split 32-bit flag in two parts - lower 16 bits owned by compiler, higher 16 bits owned by the library).

I'd suggest to use if0 bit instead which is "compiler-owned". It is named in the library merged_if0 (don't know why) and never used currently. We could also rename it, but not necessarily. We will unlikely use this bit for mergeable tasks because it is hard to implement mergeable tasks in the library with a little gain (does not worth efforts to me, at least for now).

So for explicit tied if0 detachable task compiler could use the flag 69 which is binary 0100 0101 with bits 0, 2, 6 set (0 - tied, 2 - if0, 6 - detachable).

WDYT?

Using merged_if0 as suggested by Andrey.

This revision is now accepted and ready to land.Jun 12 2020, 6:14 AM
This revision was automatically updated to reflect the committed changes.