19 #ifndef TVM_TIR_SCHEDULE_TRACE_H_ 20 #define TVM_TIR_SCHEDULE_TRACE_H_ 40 const Instruction& inst,
const Array<ObjectRef>& inputs,
const Array<ObjectRef>& attrs,
66 v->Visit(
"insts", &insts);
67 v->Visit(
"decisions", &decisions);
70 static constexpr
const char*
_type_key =
"tir.Trace";
164 #endif // TVM_TIR_SCHEDULE_TRACE_H_ TVM_DECLARE_FINAL_OBJECT_INFO(TraceNode, runtime::Object)
ObjectRef AsJSON(bool remove_postproc) const
Serialize the trace as a JSON-style object.
Optional< ObjectRef > GetDecision(const Instruction &inst) const
Retrieve the decision made on a specific instruction.
#define TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:758
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Managed reference to InstructionNode.
Definition: instruction.h:192
void Append(Instruction inst)
Append a new instruction to the trace.
runtime::TypedPackedFunc< ObjectRef(const Instruction &inst, const Array< ObjectRef > &inputs, const Array< ObjectRef > &attrs, const Optional< ObjectRef > &decision)> FTraceDecisionProvider
A callback that allows users to mutate decisions on the fly when applying instructions. The signature of the callback is:
Definition: trace.h:41
base class of all object containers.
Definition: object.h:167
Managed reference to ScheduleNode.
Definition: schedule.h:813
Array< Instruction > insts
The instructions invoked so far in the program execution.
Definition: trace.h:61
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
void ApplyToSchedule(Schedule sch, bool remove_postproc, FTraceDecisionProvider decision_provider=nullptr) const
Apply the trace to a TensorIR schedule.
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Please refer to TypedPackedFunc<R(Args..)>.
Definition: packed_func.h:60
Optional< Instruction > Pop()
Remove the last instruction, along with the decision made on that instruction, if any...
void VisitAttrs(tvm::AttrVisitor *v)
Definition: trace.h:65
Base class of all object reference.
Definition: object.h:511
Array< String > AsPython(bool remove_postproc) const
Serialize the trace as a sequence of python statements.
Trace WithDecision(Instruction inst, ObjectRef decision, bool remove_postproc) const
Create a new trace with an instruction whose decision is changed, assuming this instruction exists in...
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
Definition: map.h:1271
An execution trace of a scheduling program.
Definition: trace.h:58
Managed reference to TraceNode.
Definition: trace.h:141
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
static constexpr const char * _type_key
Definition: trace.h:70
Map< Instruction, ObjectRef > decisions
The random decisions made upon those instructions.
Definition: trace.h:63
Trace Simplified(bool remove_postproc) const
Simplify the trace with dead-code elimination.