[Openmp-commits] [PATCH] D112419: [OpenMP][OMPT][clang] task frame support fixed in __kmpc_fork_call

Vladimir Inđić via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Oct 25 02:45:40 PDT 2021

vladaindjic created this revision.
vladaindjic added reviewers: protze.joachim, jlpeyton, AndreyChurbanov, hbae.
Herald added subscribers: guansong, yaxunl.
vladaindjic requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

__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 <https://reviews.llvm.org/diffusion/L/> be the serialized parallel region that encloses another serialized 
parallel region R2 <https://reviews.llvm.org/source/clang-tools-extra/>. Assume that thread that executes R2 <https://reviews.llvm.org/source/clang-tools-extra/> is going to create a new serialized 
parallel region R3 <https://reviews.llvm.org/source/clang/> by executing __kmpc_fork_call. This thread is responsible to set enter_frame 
of R2 <https://reviews.llvm.org/source/clang-tools-extra/>’s implicit task. Note that the information about R2 <https://reviews.llvm.org/source/clang-tools-extra/>’s implicit task is present inside 
master_th->th.th_current_task at this moment, while lwt represents the information about 
R1 <https://reviews.llvm.org/diffusion/L/>’s implicit task. The old implementation uses lwt and resets enter_frame of R1 <https://reviews.llvm.org/diffusion/L/>’s implicit 
task instead of R2 <https://reviews.llvm.org/source/clang-tools-extra/>’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 <https://reviews.llvm.org/diffusion/L/> which encloses 
an explicit task T. Assume that thread should create another parallel region R2 <https://reviews.llvm.org/source/clang-tools-extra/> during the 
execution of the T. The __kmpc_fork_call is responsible to create R2 <https://reviews.llvm.org/source/clang-tools-extra/> 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 <https://reviews.llvm.org/diffusion/L/>, instead of T.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112419.381898.patch
Type: text/x-patch
Size: 9114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211025/fbd29e5d/attachment.bin>

More information about the Openmp-commits mailing list