[Openmp-commits] [PATCH] D146642: [OpenMP] Implement task record and replay mechanism

Chenle YU via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 22 09:29:36 PDT 2023


yuchenle created this revision.
yuchenle added reviewers: jdoerfert, josemonsalve2.
yuchenle created this object with edit policy "Administrators".
yuchenle added a project: OpenMP.
Herald added subscribers: sunshaoce, guansong, yaxunl.
Herald added a project: All.
yuchenle requested review of this revision.
Herald added subscribers: openmp-commits, jplehr, sstefan1.

This patch implements the "task record and replay" mechanism.  The idea is to be able to store tasks and their dependencies in the runtime so that we do not pay the cost of task creation and dependency resolution for future executions. The objective is to improve fine-grained task performance, both for those from "omp task" and "taskloop".

The entry point of the recording phase is __kmpc_start_record_task, and the end of record is triggered by __kmpc_end_record_task.

Tasks encapsulated between a record start and a record end are saved, meaning that the runtime stores their dependencies and structures, referred to as TDG, in order to replay them in subsequent executions. In these TDG replays, we start the execution by scheduling all root tasks (tasks that do not have input dependencies), and there will be no involvement of a hash table to track the dependencies, yet tasks do not need to be created again.

At the beginning of __kmpc_start_record_task, we must check if a TDG has already been recorded. If yes, the function returns 0 and starts to replay the TDG by calling __kmp_exec_tdg; if not, we start to record, and the function returns 1.

An integer uniquely identifies TDGs. Currently, this identifier needs to be incremented manually in the source code. Still, depending on how this feature would eventually be used in the library, the caller function must do it; also, the caller function needs to implement a mechanism to skip the associated region, according to the return value of __kmpc_start_record_task.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146642

Files:
  openmp/runtime/src/kmp.h
  openmp/runtime/src/kmp_global.cpp
  openmp/runtime/src/kmp_taskdeps.cpp
  openmp/runtime/src/kmp_taskdeps.h
  openmp/runtime/src/kmp_tasking.cpp
  openmp/runtime/test/tasking/omp_record_replay.cpp
  openmp/runtime/test/tasking/omp_record_replay_deps.cpp
  openmp/runtime/test/tasking/omp_record_replay_multiTDGs.cpp
  openmp/runtime/test/tasking/omp_record_replay_taskloop.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146642.507372.patch
Type: text/x-patch
Size: 43154 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230322/273581bc/attachment-0001.bin>


More information about the Openmp-commits mailing list