19#ifndef TVM_S_TIR_SCHEDULE_TRACE_H_
20#define TVM_S_TIR_SCHEDULE_TRACE_H_
44 const ffi::Array<Any>& attrs,
const Any&
decision)>;
69 namespace refl = tvm::ffi::reflection;
70 refl::ObjectDef<TraceNode>()
102 ffi::Optional<Instruction>
Pop();
146class Trace :
public ffi::ObjectRef {
155 explicit Trace(ffi::Array<Instruction> insts, ffi::Map<Instruction, Any> decisions);
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Managed reference to InstructionNode.
Definition instruction.h:191
Managed reference to ScheduleNode.
Definition schedule.h:887
An execution trace of a scheduling program.
Definition trace.h:61
void ApplyToSchedule(Schedule sch, bool remove_postproc, FTraceDecisionProvider decision_provider=nullptr) const
Apply the trace to a TensorIR schedule.
void Append(Instruction inst, Any decision)
Append a new instruction with a random decision to the trace.
ffi::Array< ffi::String > AsPython(bool remove_postproc) const
Serialize the trace as a sequence of python statements.
ffi::Optional< Instruction > Pop()
Remove the last instruction, along with the decision made on that instruction, if any.
static constexpr const bool _type_mutable
Definition trace.h:75
ffi::Array< Instruction > insts
The instructions invoked so far in the program execution.
Definition trace.h:64
Any GetDecision(const Instruction &inst) const
Retrieve the decision made on a specific instruction.
void Append(Instruction inst)
Append a new instruction to the trace.
static void RegisterReflection()
Definition trace.h:68
Trace Simplified(bool remove_postproc) const
Simplify the trace with dead-code elimination.
ffi::ObjectRef AsJSON(bool remove_postproc) const
Serialize the trace as a JSON-style object.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.Trace", TraceNode, ffi::Object)
ffi::Map< Instruction, Any > decisions
The random decisions made upon those instructions.
Definition trace.h:66
Trace WithDecision(Instruction inst, Any decision, bool remove_postproc) const
Create a new trace with an instruction whose decision is changed, assuming this instruction exists in...
Managed reference to TraceNode.
Definition trace.h:146
Trace()
Default constructor. Creating an empty trace.
static void ApplyJSONToSchedule(ffi::ObjectRef json, Schedule sch)
Apply a JSON-serialized trace to a TensorIR schedule.
Trace(ffi::Array< Instruction > insts, ffi::Map< Instruction, Any > decisions)
Constructor. Creating a trace from existing instructions and their decisions.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Trace, ffi::ObjectRef, TraceNode)
ffi::TypedFunction< Any(const Instruction &inst, const ffi::Array< Any > &inputs, const ffi::Array< Any > &attrs, const Any &decision)> FTraceDecisionProvider
A callback that allows users to mutate decisions on the fly when applying instructions....
Definition trace.h:44
Definition axis_group_graph.h:39
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40