This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Use function tracing RAII for runtime functions.
ClosedPublic

Authored by jhuber6 on Oct 18 2021, 8:32 AM.

Details

Summary

This patch adds support for using function tracing features to track the
executino of runtime functions in the device runtime library. This is
enabled by first compiling the new runtime with
-fopenmp-target-debug=3 and running with
LIBOMPTARGET_DEVICE_RTL_DEBUG=3. The output only tracks team 0 and
thread 0 so there isn't much output when using a generic region.

Diff Detail

Event Timeline

jhuber6 created this revision.Oct 18 2021, 8:32 AM
jhuber6 requested review of this revision.Oct 18 2021, 8:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2021, 8:32 AM

The output only tracks team 0 and thread 0 so there isn't much output when using a generic region.

We could even expose this via the device_environment to the user as a runtime choice (env vars).
In case this is not eliminated at compile time it's costly either way.

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

make it omp_get_thread_num though, and omp_get_team_num

jhuber6 updated this revision to Diff 380466.Oct 18 2021, 10:29 AM

Changing the interface to use the OpenMP standard functions for getting thread
numbers and team numbers. This in theory will allow the implementation to more
generally follow the thread doing the actual execution. The implementation of
these on the device are not currently correct however, so this won't work as
intended until omp_get_thread_num() is fixed on the device.

jhuber6 updated this revision to Diff 383437.Oct 29 2021, 11:17 AM

Changing back to use the mapping functions, can be fixed later once there's a
better interface to getting the effective initial thread in generic and SPMD
regions from any arbitrary location.

This revision is now accepted and ready to land.Oct 29 2021, 11:22 AM
This revision was automatically updated to reflect the committed changes.