Poplar and PopLibs
|
DebugInfo stores and persists a set of data that describes the context of an operation. More...
#include <DebugContext.hpp>
Inherited by poputil::OpDebugInfo.
Public Member Functions | |
DebugInfo (const DebugContext &debugContext, std::string layer) | |
Constructor. More... | |
DebugId | getId () const |
Gets the unique identifier of this DebugInfo object. | |
std::string | getPathName () const |
Gets the pathname of this object (as received from DebugContext). | |
bool | setValue (std::string name, ProfileValue value) |
Adds custom data to this object if "name" is not already set. More... | |
Static Public Member Functions | |
static void | initializeStreamer (const std::string &fileName, const DebugSerializationFormat &format=DebugSerializationFormat::CBOR) |
Initializes the streamer, unless it is already initialized (for example through env variables). More... | |
static void | closeStreamer () |
Closes the streamer: all data is flushed to disk and the file is ready to be read. More... | |
DebugInfo stores and persists a set of data that describes the context of an operation.
Some of that data is structured, such as the framework layer name (Poplar, PopLibs, PopART, and so on) or the file and line of the source code. But it can also be custom data set by the user through setValue
method.
In turn, the DebugInfo is passed to sub-operations of that operation so that resources (Program, Variable, and other object types) created in lower levels can be hierarchically related to the initial DebugInfo.
After execution, the created DebugInfo has been written to a file. At the same time, the operation resources have been persisted in the graph and execution profile, together with their DebugInfo ID. In this way, tools like PopVision can conveniently present to the user: the operation, its resources, and its DebugInfo.
This class is expected to be derived to adapt to particular use cases (typically, by adding extra mandatory arguments to the constructor). Internally, derived classes can use setValue() to store the extra data to be persisted.
At object destruction, the DebugInfo data is passed to the streamer to be written to a file. Thus, the streamer should be initialized before any DebugInfo object gets destroyed, or it will not be persisted.
poplar::DebugInfo::DebugInfo | ( | const DebugContext & | debugContext, |
std::string | layer | ||
) |
Constructor.
debugContext | Captures the external context of the operation (for example, file and line of invocation). |
layer | Name of the framework level (for example, Poplar, PopLibs or PopART). |
|
static |
Closes the streamer: all data is flushed to disk and the file is ready to be read.
DebugInfo objects destroyed after this point will not be persisted.
|
static |
Initializes the streamer, unless it is already initialized (for example through env variables).
fileName | The name of the file where all DebugInfo objects will be persisted. |
format | The format of the file (JSON or CBOR). |
bool poplar::DebugInfo::setValue | ( | std::string | name, |
ProfileValue | value | ||
) |
Adds custom data to this object if "name" is not already set.
name | The key name of the data. |
value | A ProfileValue object containing the custom data. |