This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Device Time Profile
Needs ReviewPublic

Authored by nrj5k on Sep 7 2022, 5:09 PM.

Details

Reviewers
jdoerfert
Summary

Adding functionality to
— collect time information from the target devices
sideloads the collected data TimeProfiler Entrys

Resulting in a Libomptarget Profile containing host + target information.

Diff Detail

Event Timeline

nrj5k created this revision.Sep 7 2022, 5:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 7 2022, 5:09 PM
nrj5k requested review of this revision.Sep 7 2022, 5:09 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 7 2022, 5:09 PM

Can you 1) upload the patches with full context (see https://llvm.org/docs/Contributing.html#how-to-submit-a-patch) and 2) split it into the refactor of the timer facility and the OpenMP patch.

jdoerfert retitled this revision from Device Time Profile to [OpenMP] Device Time Profile.Oct 25 2022, 10:07 PM
nrj5k updated this revision to Diff 481041.Dec 7 2022, 1:39 PM
nrj5k edited the summary of this revision. (Show Details)
  • only contains OpenMP patch for Device Time Profile.
  • patch contains full context
nrj5k edited the summary of this revision. (Show Details)Dec 7 2022, 1:40 PM

I left some initial comments, I think this is not in a "working" state, it looks like parts are missing, beyond the LLVM changes.

openmp/libomptarget/DeviceRTL/src/Kernel.cpp
25

Leftover

45

Turn this around.

if (Idx >= OMP_ARRAY_SIZE)
  return OMP_ARRAY_SIZE
...

Where does OMP_ARRAY_SIZE and OMP_THREADS come from? Shouldn't those be read from the struct the runtime initializes?

50

Don't use parallel here. This is the device runtime.
Depending on where this is called, all threads will execute it anyway.
Just use mapping::getThreadIdInBlock() to get the thread id and mapping::getBlockId() to get the block id.
Same above.

120

What is this?

170

And this?

jplehr added a subscriber: jplehr.Dec 8 2022, 7:19 AM

Can you please describe at a high level what data "Device Time Profile" is supposed to collect and how you are collecting it? Is there a specification somewhere for this functionality?

Can you please describe at a high level what data "Device Time Profile" is supposed to collect and how you are collecting it? Is there a specification somewhere for this functionality?

The profile collects time spend between user (or compiler) placed calls to start/stop a timer. The patch is not complete and I am not sure if Neeraj monitors these emails.
The values are spliced into our LIBOMPTARGET_PROFILE output, so you view it the same way, e.g., via Chrome tracing.