19 #ifndef TVM_TIR_SCHEDULE_TRACE_H_
20 #define TVM_TIR_SCHEDULE_TRACE_H_
66 v->Visit(
"insts", &
insts);
70 static constexpr
const char*
_type_key =
"tir.Trace";
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
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Please refer to TypedPackedFunc<R(Args..)>.
Definition: packed_func.h:63
Managed reference to InstructionNode.
Definition: instruction.h:192
Managed reference to ScheduleNode.
Definition: schedule.h:877
An execution trace of a scheduling program.
Definition: trace.h:58
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< Instruction, ObjectRef > decisions
The random decisions made upon those instructions.
Definition: trace.h:63
void VisitAttrs(tvm::AttrVisitor *v)
Definition: trace.h:65
void Append(Instruction inst, ObjectRef decision)
Append a new instruction with a random decision to the trace.
ObjectRef AsJSON(bool remove_postproc) const
Serialize the trace as a JSON-style object.
void ApplyToSchedule(Schedule sch, bool remove_postproc, FTraceDecisionProvider decision_provider=nullptr) const
Apply the trace to a TensorIR schedule.
TVM_DECLARE_FINAL_OBJECT_INFO(TraceNode, runtime::Object)
Optional< Instruction > Pop()
Remove the last instruction, along with the decision made on that instruction, if any.
Optional< ObjectRef > GetDecision(const Instruction &inst) const
Retrieve the decision made on a specific instruction.
Array< String > AsPython(bool remove_postproc) const
Serialize the trace as a sequence of python statements.
Trace Simplified(bool remove_postproc) const
Simplify the trace with dead-code elimination.
static constexpr const char * _type_key
Definition: trace.h:70
Array< Instruction > insts
The instructions invoked so far in the program execution.
Definition: trace.h:61
void Append(Instruction inst)
Append a new instruction to the trace.
Managed reference to TraceNode.
Definition: trace.h:141
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(Trace, runtime::ObjectRef, TraceNode)
Trace()
Default constructor. Creating an empty trace.
static void ApplyJSONToSchedule(ObjectRef json, Schedule sch)
Apply a JSON-serialized trace to a TensorIR schedule.
Trace(Array< Instruction > insts, Map< Instruction, ObjectRef > decisions)
Constructor. Creating a trace from existing instructions and their decisions.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36