nv-legate / legate.core

The Foundation for All Legate Libraries
https://docs.nvidia.com/legate/24.06/
Apache License 2.0
189 stars 63 forks source link

Expose API for creating sub-boxes on the profiler #960

Open manopapad opened 3 days ago

manopapad commented 3 days ago

These are the calls that will start a "sub-box" within a "parent box" on the profiler: https://gitlab.com/StanfordLegion/legion/-/blob/209675d6c3aeb5f74cc0f55fffae2e3ef34dec67/runtime/legion.h?page=9#L8531-8543

We want to expose it through the Scope class, for C++ and Python.

E.g. this feature could be used to separate out a part of a long-running task:

@task
def foo():
  # do stuff
  with Scope(...):
     # do stuff, that will appear under a sub-box within foo's overall box
  # do stuff
magnatelee commented 3 days ago

One problem with how Scope is currently set up is that it's a global state maintained by the runtime. So, we need to keep track of Scopes for individual tasks so they won't get clobbered by each other.