31 template<
typename ObjType,
typename MemberType,
typename... Args>
32 bool lexLess(
const ObjType & l,
const ObjType & r, MemberType ObjType::* member, Args &&... args)
33 {
return (l.*member) < (r.*member) || ((l.*member == r.*member) &&
lexLess(l, r, std::forward<Args>(args)...)); }
38 template<
typename ObjType,
typename MemberType,
typename... Args>
39 bool eq(
const ObjType & l,
const ObjType & r, MemberType ObjType::* member, Args &&... args)
40 {
return (l.*member == r.*member) &&
eq(l, r, std::forward<Args>(args)...); }
43 template<
typename ObjType,
typename MemberType>
44 bool lexLess(
const ObjType & l,
const ObjType & r, MemberType ObjType::* member)
45 {
return (l.*member) < (r.*member); }
48 template<
typename ObjType,
typename MemberType>
49 bool eq(
const ObjType & l,
const ObjType & r, MemberType ObjType::* member)
50 {
return (l.*member) == (r.*member); }
69 bool operator==(
const EnumValue & other)
const {
return eq(*
this, other, &EnumValue::type, &EnumValue::value); }
80 Pointer(
const std::type_index & t, std::uintptr_t v);
94 std::uintptr_t
function;
97 {
return lexLess(*
this, other, &Update::owner, &Update::id, &Update::function); }
99 {
return eq(*
this, other, &Update::owner, &Update::id, &Update::function); }
109 bool operator==(
const Output & other)
const {
return eq(*
this, other, &Output::owner, &Output::id); }
120 {
return lexLess(*
this, other, &Input::owner, &Input::id, &Input::source); }
121 bool operator==(
const Input & other)
const {
return eq(*
this, other, &Input::owner, &Input::id, &Input::source); }
133 return lexLess(*
this, other, &InputDependency::owner, &InputDependency::update, &InputDependency::source,
134 &InputDependency::input);
138 return eq(*
this, other, &InputDependency::owner, &InputDependency::update, &InputDependency::source,
139 &InputDependency::input);
150 {
return lexLess(*
this, other, &OutputDependency::owner, &OutputDependency::update, &OutputDependency::output); }
152 {
return eq(*
this, other, &OutputDependency::owner, &OutputDependency::update, &OutputDependency::output); }
162 {
return lexLess(*
this, other, &InternalDependency::owner, &InternalDependency::from, &InternalDependency::to); }
164 {
return eq(*
this, other, &InternalDependency::owner, &InternalDependency::from, &InternalDependency::to); }
176 return lexLess(*
this, other, &DirectDependency::owner, &DirectDependency::output, &DirectDependency::source,
177 &DirectDependency::input);
181 return eq(*
this, other, &DirectDependency::owner, &DirectDependency::output, &DirectDependency::source,
182 &DirectDependency::input);
187 std::pair<std::vector<Log::Output>, std::vector<Log::Update>>
subGraph(
const CallGraph *
const g)
const;
190 std::pair<std::vector<Log::Output>, std::vector<Log::Update>>
subGraph(
const Output out)
const;
201 std::string
generateDot(
const std::vector<Log::Output> & outHighlight = {},
202 const std::vector<Log::Update> & upHighlight = {})
const;
232 std::map<std::uintptr_t, std::vector<std::type_index>>
types_;
235 std::pair<std::vector<Log::Output>, std::vector<Log::Update>> followUpDependency(
236 const std::vector<Output> & allOutputs,
237 const std::vector<Output> & startingPoints)
const;
242 std::string nodeName(
const Log::Output & output)
const;
246 std::string nodeName(
const Log::Input & input)
const;
250 std::string nodeName(
const Log::Update & update)
const;
255 { static_assert(std::is_enum<E>::value,
"EnumValue can only be defined for enums."); }
#define TVM_DLLAPI
Definition: api.h:35
Definition: CallGraph.h:23
const std::type_index & getPromotedType(const Pointer &p) const
std::vector< InternalDependency > internalDependencies_
Definition: Log.h:216
std::vector< OutputDependency > outputDependencies_
Definition: Log.h:215
std::pair< std::vector< Log::Output >, std::vector< Log::Update > > subGraph(const Output out) const
std::string generateDot(const std::vector< Log::Output > &outHighlight={}, const std::vector< Log::Update > &upHighlight={}) const
std::vector< Output > outputs_
Definition: Log.h:213
std::vector< Input > inputs_
Definition: Log.h:212
std::pair< std::vector< Log::Output >, std::vector< Log::Update > > subGraph(const CallGraph *const g) const
std::vector< Update > updates_
Definition: Log.h:211
std::vector< InputDependency > inputDependencies_
Definition: Log.h:214
std::map< Pointer, std::vector< Pointer > > graphOutputs_
Definition: Log.h:222
std::string generateDot(const CallGraph *const g) const
std::vector< DirectDependency > directDependencies_
Definition: Log.h:217
std::map< std::uintptr_t, std::vector< std::type_index > > types_
Definition: Log.h:232
std::string generateDot(const Pointer &p) const
bool lexLess(const ObjType &l, const ObjType &r, MemberType ObjType::*member, Args &&... args)
Definition: Log.h:32
bool eq(const ObjType &l, const ObjType &r, MemberType ObjType::*member, Args &&... args)
Definition: Log.h:39
bool operator==(const DirectDependency &other) const
Definition: Log.h:179
Pointer owner
Definition: Log.h:173
Pointer source
Definition: Log.h:172
bool operator<(const DirectDependency &other) const
Definition: Log.h:174
EnumValue output
Definition: Log.h:171
EnumValue input
Definition: Log.h:170
std::type_index type
Definition: Log.h:65
bool operator==(const EnumValue &other) const
Definition: Log.h:69
bool operator<(const EnumValue &other) const
Definition: Log.h:68
int value
Definition: Log.h:66
EnumValue(E e)
Definition: Log.h:254
Pointer owner
Definition: Log.h:160
bool operator==(const InternalDependency &other) const
Definition: Log.h:163
EnumValue to
Definition: Log.h:159
bool operator<(const InternalDependency &other) const
Definition: Log.h:161
EnumValue from
Definition: Log.h:158
EnumValue update
Definition: Log.h:146
Pointer owner
Definition: Log.h:148
EnumValue output
Definition: Log.h:147
bool operator==(const OutputDependency &other) const
Definition: Log.h:151
bool operator<(const OutputDependency &other) const
Definition: Log.h:149
bool operator==(const Output &other) const
Definition: Log.h:109
std::string name
Definition: Log.h:106
Pointer owner
Definition: Log.h:107
EnumValue id
Definition: Log.h:105
bool operator<(const Output &other) const
Definition: Log.h:108
std::type_index type
Definition: Log.h:82
bool operator<(const Pointer &other) const
Definition: Log.h:85
bool operator==(const Pointer &other) const
Definition: Log.h:86
Pointer(T *p)
Definition: Log.h:258
std::uintptr_t value
Definition: Log.h:83
bool operator==(const Update &other) const
Definition: Log.h:98
bool operator<(const Update &other) const
Definition: Log.h:96
Pointer owner
Definition: Log.h:95
EnumValue id
Definition: Log.h:92
std::string name
Definition: Log.h:93