Page MenuHomePhabricator

[OpenMP][Tool] Handle detached tasks in Archer
ClosedPublic

Authored by protze.joachim on Jun 5 2020, 3:36 PM.

Details

Summary

Since detached tasks are supported by clang and the OpenMP runtime, Archer must expect to receive the corresponding callbacks.

This patch adds support to interpret the synchronization semantics of omp_fulfill_event and cleans up the handling of task switches.
The task_late_fulfill.c currently cannot use if(0) for the first task to avoid the race on f_event.

Diff Detail

Event Timeline

protze.joachim created this revision.Jun 5 2020, 3:36 PM

The tests of cause require tsan.
Also added build dependence to tsan, if tsan is built in the same build.

Fixed handling of ompt_task_cancel.

jdoerfert accepted this revision.Oct 29 2020, 1:00 PM

This looks reasonable, not that I have much experience with ARCHER.

openmp/tools/archer/tests/task/task_late_fulfill.c
39

Leftover?

This revision is now accepted and ready to land.Oct 29 2020, 1:00 PM
protze.joachim closed this revision.Nov 4 2020, 2:23 AM

Pushed as e99207feb4b901e8f7bb6d3e70388d31fafc4330, missed to include the Revision line.

ye-luo added a subscriber: ye-luo.Nov 4 2020, 2:47 PM
ye-luo added inline comments.
openmp/tools/archer/tests/task/task_late_fulfill.c
37

de-referencing uninitialized pointer f_event? I expect no task has been run at this point.

ye-luo added inline comments.Nov 4 2020, 4:51 PM
openmp/tools/archer/tests/task/task_late_fulfill.c
37

de-referencing uninitialized pointer f_event? I expect no task has been run at this point.

This test is probably good.
When OMP_NUM_THREADS>1, there are additional threads available for picking up task 1 and task must be completed within 20000 usec. Not robust but probably OK.
When OMP_NUM_THREADS=1, the parallel is inactive and task 1 runs immediately, task 2 is deferred due to dependency, So this test also works fine.

Original intention was to have if(0) on the first task. Unfortunately, clang drops the out dependency for detached tasks in that case: https://bugs.llvm.org/show_bug.cgi?id=46185
Once the clang bug is fixed, we can add the if(0) and make the test more robust.

openmp/tools/archer/tests/task/task_late_fulfill.c
37

During discussion for the OpenMP Examples document, I realized that taking the address is not necessary. I pushed a fix as 3fa2e193384048daafe1fa74bf88253b4cf5ce6e.