This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] [OMPD] [2/6] Implementation of OMPD debugging library - libompd. TargetValue: Access OpenMP runtime state through callbacks provided by tool
ClosedPublic

Authored by Vigneshbalu on Apr 9 2021, 5:23 AM.

Details

Summary

This is part of review: https://reviews.llvm.org/D100181
Creates a new directory "libompd" under openmp.

"TargetValue" provides operational access to the OpenMP runtime memory for OMPD APIs.
With TargetValue, using "pointer" a user can do multiple operations from casting, dereferencing to accessing an element for structure.
The member functions are designed to concatenate the operations that are needed to access values from structures.

e.g., _a[6]->_b._c would read like :
TValue(ctx, "_a").cast("A",2).getArrayElement(6).access("_b").cast("B").access("_c")

For example:
If you have a pointer "ThreadHandle" of a running program then you can access/retrieve "threadID" from the memory using TargetValue as below.

    TValue(context, thread_handle->th) /*__kmp_threads[t]->th*/
                .cast("kmp_base_info_t")
                .access("th_info") /*__kmp_threads[t]->th.th_info*/
                .cast("kmp_desc_t")
                .access("ds") /*__kmp_threads[t]->th.th_info.ds*/
                .cast("kmp_desc_base_t")
                .access("ds_thread") /*__kmp_threads[t]->th.th_info.ds.ds_thread*/
                .cast("kmp_thread_t")
.getRawValue(thread_id, 1);

Diff Detail

Event Timeline

Vigneshbalu created this revision.Apr 9 2021, 5:23 AM
Vigneshbalu requested review of this revision.Apr 9 2021, 5:23 AM
Herald added a project: Restricted Project. · View Herald Transcript
Vigneshbalu changed the visibility from "Public (No Login Required)" to "Vigneshbalu (Vignesh Balasubramanian)".Apr 9 2021, 7:55 AM
Vigneshbalu changed the visibility from "Vigneshbalu (Vignesh Balasubramanian)" to "Public (No Login Required)".Apr 11 2021, 9:47 AM

Addressed clang-tidy warnings.

Rebasing the patch

Rebasing the patch.

Vigneshbalu edited the summary of this revision. (Show Details)Aug 10 2021, 1:59 AM

Gentle Reminder !

hbae added a comment.Aug 26 2021, 4:47 PM

Looks good to me except for a couple of typos.

openmp/libompd/src/TargetValue.h
95

concatenate

203

array

Fixing the typos.

Vigneshbalu marked 2 inline comments as done.Aug 29 2021, 7:15 AM

Thanks for the catch. Fixed it.

hbae accepted this revision.Aug 30 2021, 5:46 AM

LGTM

This revision is now accepted and ready to land.Aug 30 2021, 5:46 AM
mceier added a subscriber: mceier.Sep 3 2021, 10:07 AM
mceier added inline comments.
openmp/libompd/src/CMakeLists.txt
49–50

At least these two destinations ignore OPENMP_INSTALL_LIBDIR leading to mixing of 32-bit libs with 64-bit libs in multilib setup,
It should use ${OPENMP_INSTALL_LIBDIR} like ./tools/archer/CMakeLists.txt does.