|
TVM
0.9.4
|
#include <tvm/diagnostic/GraphProbe.h>
Classes | |
| struct | ProbeNode |
Public Types | |
| using | Output = graph::internal::Log::Output |
| using | Update = graph::internal::Log::Update |
| using | OutputVal = std::tuple< Output, VariablePtr, Eigen::MatrixXd > |
Public Member Functions | |
| GraphProbe (const graph::internal::Log &log=tvm::graph::internal::Logger::logger().log()) | |
| template<typename T , typename MethodT , typename EnumOutput , typename ConvertT = std::nullopt_t> | |
| void | registerAccessor (EnumOutput o, MethodT method, ConvertT convert=std::nullopt) |
| template<typename T > | |
| void | registerTVMFunction () |
| template<typename T > | |
| void | registerTVMConstraint () |
| template<typename T > | |
| void | registerTVMTaskDynamics () |
| std::vector< OutputVal > | listOutputVal (const graph::CallGraph *const g, bool verbose=false) const |
| std::vector< OutputVal > | listOutputVal (const Output &o, bool verbose=false) const |
| std::unique_ptr< ProbeNode > | followUp (const Output &o, const std::function< bool(const Eigen::MatrixXd &)> &select=[](const Eigen::MatrixXd &) { return true;}) const |
| std::vector< std::unique_ptr< ProbeNode > > | followUp (const graph::CallGraph *const g, const std::function< bool(const Eigen::MatrixXd &)> &select=[](const Eigen::MatrixXd &) { return true;}) const |
| void | print (std::ostream &os, const std::unique_ptr< ProbeNode > &root) const |
| void | print (std::ostream &os, const std::vector< std::unique_ptr< ProbeNode >> &roots) const |
Static Public Attributes | |
| static constexpr auto | absInRange |
| static constexpr auto | hasNan = [](const Eigen::MatrixXd & M) { return M.hasNaN(); } |
A class to explore the value computed in a call graph.
Because the tvm nodes only declare the dependencies between inputs, updates and outputs, but not the way to retrieve an output, it is necessary to register first the method used to access each output of interest. This is done atomically with the methods GraphNode::registerAccessor, or at higher level with the methods GraphNode::registerTVMFunction, GraphNode::registerTVMConstraint and GraphNode::registerTVMTaskDynamics. Access methods for base tvm classes are automatically registered in the constructor.
| using tvm::diagnostic::GraphProbe::OutputVal = std::tuple<Output, VariablePtr, Eigen::MatrixXd> |
| tvm::diagnostic::GraphProbe::GraphProbe | ( | const graph::internal::Log & | log = tvm::graph::internal::Logger::logger().log() | ) |
Constructor
| std::vector<std::unique_ptr<ProbeNode> > tvm::diagnostic::GraphProbe::followUp | ( | const graph::CallGraph *const | g, |
| const std::function< bool(const Eigen::MatrixXd &)> & | select = [](const Eigen::MatrixXd &) { return true;} |
||
| ) | const |
Follow up backward the computation graph starting at the inputs of g, and trimming out branches where the value of an output does not pass the test given by select.
| std::unique_ptr<ProbeNode> tvm::diagnostic::GraphProbe::followUp | ( | const Output & | o, |
| const std::function< bool(const Eigen::MatrixXd &)> & | select = [](const Eigen::MatrixXd &) { return true;} |
||
| ) | const |
Follow up backward the computation graph starting at node o, and trimming out branches where the value of an output does not pass the test given by select.
| std::vector<OutputVal> tvm::diagnostic::GraphProbe::listOutputVal | ( | const graph::CallGraph *const | g, |
| bool | verbose = false |
||
| ) | const |
List all the values of all the outputs present in the call graph g (if the associated methods were registered).
If verbose is true, display the outputs for which no methods were registered to retrieve their values.
| std::vector<OutputVal> tvm::diagnostic::GraphProbe::listOutputVal | ( | const Output & | o, |
| bool | verbose = false |
||
| ) | const |
List all the values of all the outputs on which o depends (recursively) (if the associated methods were registered).
If verbose is true, display the outputs for which no methods were registered to retrieve their values.
| void tvm::diagnostic::GraphProbe::print | ( | std::ostream & | os, |
| const std::unique_ptr< ProbeNode > & | root | ||
| ) | const |
Print in os the tree starting at root.
| void tvm::diagnostic::GraphProbe::print | ( | std::ostream & | os, |
| const std::vector< std::unique_ptr< ProbeNode >> & | roots | ||
| ) | const |
Print in os the trees starting each at an element of root.
|
inline |
Register a method fn to retrieve the value associated to o
The method either takes a variable or does not
| T | type of the node to which the method is attached. It must be given explicitly if the method is inherited from a base class, otherwise the method will be registered for this base class. |
|
inline |
Register all methods associated to outputs inherited from tvm::constraint::abstract::Constraint
|
inline |
Register all methods associated to outputs inherited from tvm::function::abstract::Function
|
inline |
Register all methods associated to outputs inherited from tvm::task_dynamics::abstract::TaskDynamicsImpl
|
staticconstexpr |
Factory returning a function checking if a matrix M has elements whose absolute value is between rmin and rmax.
This function can be used as a select function in GraphProbe::followUp.
|
staticconstexpr |
Function checking if M contains NaN.
This function can be used as a select function in GraphProbe::followUp.