This is an archive of the discontinued LLVM Phabricator instance.

New implementation of OpenMP 5.0 detached tasks.
ClosedPublic

Authored by AndreyChurbanov on May 27 2019, 6:37 AM.

Details

Summary

Patch by Alex Duran.

It adds new task flag - detachable (bit 6, or 0x40) which can be set by compiler for a detached task;
new external entry omp_fulfill_event(), and new internal entry __kmpc_task_allow_completion_event().

Tests with samples of expected compiler codegen also provided, they use various timings of event notification versus task completion (before/after task completion, or before task start).

Diff Detail

Repository
rL LLVM

Event Timeline

This revision is now accepted and ready to land.Jun 18 2019, 1:19 PM

Are there any plans to add the code for the appropriate OMPT callbacks?

protze.joachim added inline comments.Jun 19 2019, 1:16 AM
runtime/test/tasking/kmp_detach_tasks_t1.c
73 ↗(On Diff #201520)

there is omp_my_sleep.h in runtime/tests/
please consider to use that instead

runtime/test/tasking/kmp_detach_tasks_t3.c
21 ↗(On Diff #201520)

Is there any reason not to include kmp.h for the definition of the structs?

I know, other tests also define them locally.

AndreyChurbanov marked 2 inline comments as done.

Addressed Joachim's comments.

runtime/test/tasking/kmp_detach_tasks_t3.c
21 ↗(On Diff #201520)

This is general position - make tests independent of the library sources. Presence of the built <binaries + public headers> should be enough to run tests.

Are there any plans to add the code for the appropriate OMPT callbacks?

Haven't thought of this yet. I'd actually appreciate somebody's help here. Who is more familiar with OMPT and with tasking events in particular, and with OMPT tests.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 19 2019, 6:20 AM
hbae added a comment.Jun 19 2019, 6:54 AM

Joachim, do you have any specific OMPT callbacks in mind?
I don't think we have any callbacks to insert in the new code.

Shall the compiler generate the call of omp_fulfill_event after __kmpc_omp_task call? Or is it a user code?

Shall the compiler generate the call of omp_fulfill_event after __kmpc_omp_task call? Or is it a user code?

User code supposed to call the omp_fulfill_event to signal completion of the corresponding detached task.

Three tests provided to cover three cases: user called omp_fulfill_event (1) after task body completed execution, (2) possibly during execution of the task, and (3) before the task was scheduled for execution.

Shall the compiler generate the call of omp_fulfill_event after __kmpc_omp_task call? Or is it a user code?

User code supposed to call the omp_fulfill_event to signal completion of the corresponding detached task.

Three tests provided to cover three cases: user called omp_fulfill_event (1) after task body completed execution, (2) possibly during execution of the task, and (3) before the task was scheduled for execution.

Thanks for the clarification! This is what I thought.

Joachim, do you have any specific OMPT callbacks in mind?
I don't think we have any callbacks to insert in the new code.

Sorry for the late reply.
Two changes are necessary:

  • __ompt_task_finish should only set ompt_task_complete, if the task is complete (probably move the call after the bit is updated). Otherwise ompt_task_switchshould be used.
  • The task-fulfill event needs implementation (see omp_fulfill_event).