[OpenMP] Support kernel record and replay
authorGiorgis Georgakoudis <georgakoudis1@llnl.gov>
Tue, 17 Jan 2023 23:35:44 +0000 (15:35 -0800)
committerGiorgis Georgakoudis <georgakoudis1@llnl.gov>
Wed, 18 Jan 2023 00:29:03 +0000 (16:29 -0800)
commit94c772dc923a63abc744c011db51cecfe80cf093
tree88d21e55a4bbed85971845b99384faa628f6d87c
parent9bd69ae8f77e6339733ab8ef7783b5c73cffdb98
[OpenMP] Support kernel record and replay

This patch adds functionality for recording and replaying the execution of OpenMP offload kernels, based on an original implementation by Steve Rangel. The patch extends libomptarget to extract a json description of the kernel, the device image binary, and a device memory snapshot before and after the execution of a recorded kernel. Kernel recording/replaying in libomptarget is controlled through env vars (LIBOMPTARGET_RECORD, LIBOMPTARGET_REPLAY). It provides a tool, llvm-omp-kernel-replay, for replaying a kernel using the extracted information with the ability to verify replayed execution using the post-execution device memory snapshot, also supporting changing the number of teams/threads for replaying.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D138931
openmp/libomptarget/include/omptarget.h
openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
openmp/libomptarget/src/exports
openmp/libomptarget/src/interface.cpp
openmp/libomptarget/src/omptarget.cpp
openmp/libomptarget/src/private.h
openmp/libomptarget/tools/CMakeLists.txt
openmp/libomptarget/tools/kernelreplay/CMakeLists.txt [new file with mode: 0644]
openmp/libomptarget/tools/kernelreplay/llvm-omp-kernel-replay.cpp [new file with mode: 0644]