This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add function tracing debugging to device RTL
ClosedPublic

Authored by jhuber6 on Sep 21 2021, 2:43 PM.

Details

Summary

This patch adds support for an RAII struct that will print function
traces when placed inside of a function declaration. Each successive
call will increase the indentation to make it easier to visually
inspect.

Diff Detail

Event Timeline

jhuber6 created this revision.Sep 21 2021, 2:43 PM
jhuber6 requested review of this revision.Sep 21 2021, 2:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2021, 2:43 PM
tianshilei1992 added inline comments.Sep 21 2021, 3:55 PM
openmp/libomptarget/DeviceRTL/include/Configuration.h
22–23
openmp/libomptarget/DeviceRTL/include/Debug.h
32

Just ENTER?

jhuber6 added inline comments.Sep 21 2021, 3:56 PM
openmp/libomptarget/DeviceRTL/include/Debug.h
32

Wasn't sure what to call it, could be like FunctionTrace or something.

Add them to the entry points and some other "important functions" like parallel_51.

openmp/libomptarget/DeviceRTL/include/Debug.h
32

#define FunctionTracingRAII()

34

Documentation, also for the macro.

openmp/libomptarget/DeviceRTL/src/Debug.cpp
48

swap these two, same below.

jhuber6 updated this revision to Diff 374063.Sep 21 2021, 4:17 PM

Addressing comments.

jdoerfert accepted this revision.Sep 21 2021, 4:24 PM

LG, one nit.

openmp/libomptarget/DeviceRTL/src/Debug.cpp
42

This needs to be in shared memory. static works fine, no namespace needed.

This revision is now accepted and ready to land.Sep 21 2021, 4:24 PM
jhuber6 updated this revision to Diff 374076.Sep 21 2021, 5:38 PM

Changing to shared, removing FILE because it includes the whole path and takes up a lot of space.

jhuber6 marked 4 inline comments as done.Sep 21 2021, 5:46 PM
This revision was landed with ongoing or failed builds.Sep 22 2021, 9:25 AM
This revision was automatically updated to reflect the committed changes.
tianshilei1992 added inline comments.Oct 27 2021, 9:20 AM
openmp/libomptarget/DeviceRTL/src/Debug.cpp
52

There are four placeholders but only three arguments. What is the last %u?

jhuber6 added inline comments.Oct 27 2021, 9:58 AM
openmp/libomptarget/DeviceRTL/src/Debug.cpp
52

Fixed in D112002, but it hasn't been reviewed.