These patches propose the implementation of OMPD, a debugging interface to support debugging of OpenMP programs.
"libompd.so" acts as an interface to the third-party tools, typically the debuggers. The tool accesses the state of the OpenMP program through the library and libompd can read or write the state of the OpenMP program that has begun execution through the callback function provided by the tool.
A brief talk regarding the upstreaming plans was provided a few months back in the LLVM-OpenMP committee meeting, the notes of which were provided at:
https://docs.google.com/document/d/1OeibmJ41dndC7xqVFNHwfLJx3hM5uFErBrsmp2nrV2w/edit?usp=sharing
Most of the implementation has been contributed to by folks from RWTH-Aachen University, LLNL, Rice University, Perforce, AMD and others. (Might have missed out some of the contributors – apologies for that). It has been developed and maintained in https://github.com/OpenMPToolsInterface/llvm-project/tree/ompd-tests/openmp
OMPD support is restricted only to CPU and Linux currently.
OMPD APIs are implemented as per the OpenMP 5.0 standard https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf .
These patches also include some gdb-plugin code which is a python module which can be loaded into the debugger, gdb. This provides OMPD specific debugging commands once the "ompd init" command is invoked at the gdb prompt. More details regarding this are provided in the README available in the gdb-plugin directory.
CMake build system and directory structure are similar to the openmp/runtime and openmp/libomptarget.
Testing is done by two methods. First by comparing the output of OMPT and OMPD, second through gdb-plugin using llvm-lit and Filecheck.
This implementation does not provide debugging support for offloading to CPUs or GPUs.
The breakdown of patches is below.
Note: Patches should be applied in the below order.
- Code changes in openmp/runtime to support libompd.
- TargetValue: Access OpenMP runtime state through callbacks provided by the tool.
- omp-debug: Implementation of OMPD APIs.
- omp-icv: OMPD Internal control variable handlers.
- gdb-plugin: A Plugin code to gdb to leverage libompd to provide debugging support.
- libompd-tests: Testcases for libompd.
Another set of around 50 testcases will be pushed subsequently.
Please let me know if the patches need to be reorganized.
We need to use ompd_wait_id_t.