Page MenuHomePhabricator

[OpenMP][OMPT][clang] task frame support fixed in __kmpc_fork_call
ClosedPublic

Authored by vladaindjic on Oct 25 2021, 2:45 AM.

Details

Summary

__kmp_fork_call sets the enter_frame of the active task (th_curren_task)
before new parallel region begins. After the region is finished, the
enter_frame is cleared.

The old implementation of __kmpc_fork_call didn’t clear the enter_frame of active task.

Also, the way of initializing the enter_frame of the active task was wrong.
Consider the following two OpenMP programs.

The first program: Let R1 be the serialized parallel region that encloses another serialized
parallel region R2. Assume that thread that executes R2 is going to create a new serialized
parallel region R3 by executing __kmpc_fork_call. This thread is responsible to set enter_frame
of R2’s implicit task. Note that the information about R2’s implicit task is present inside
master_th->th.th_current_task at this moment, while lwt represents the information about
R1’s implicit task. The old implementation uses lwt and resets enter_frame of R1’s implicit
task instead of R2’s implicit task. The new implementation uses
master_th->th.th_current_task instead.

The second program: Consider the OpenMP program that contains parallel region R1 which encloses
an explicit task T. Assume that thread should create another parallel region R2 during the
execution of the T. The __kmpc_fork_call is responsible to create R2 and set enter frame of T
whose information is present inside the master_th->th.th_current_task.
Old implementation tries to set the frame of parent_team->t.t_implicit_task_taskdata[tid]
which corresponds to the implicit task of the R1, instead of T.

Diff Detail

Event Timeline

vladaindjic created this revision.Oct 25 2021, 2:45 AM
vladaindjic requested review of this revision.Oct 25 2021, 2:45 AM
Herald added a project: Restricted Project. · View Herald Transcript
  • clang-formated diffs in kmp_csupport.cpp
protze.joachim accepted this revision.Oct 25 2021, 8:26 AM

Looks like we missed to update the code in kmp_csupport, when the management of lwt was refactored.
lgtm

This revision is now accepted and ready to land.Oct 25 2021, 8:26 AM

@protze.joachim Thank you for the revision. Could you please land this commit for me?