19#ifndef TVM_S_TIR_SCHEDULE_INSTRUCTION_H_
20#define TVM_S_TIR_SCHEDULE_INSTRUCTION_H_
22#include <tvm/ffi/reflection/registry.h>
43 ffi::TypedFunction<ffi::Array<Any>(
Schedule sch,
const ffi::Array<Any>& inputs,
44 const ffi::Array<Any>& attrs,
const Any& decision)>;
55 ffi::TypedFunction<ffi::String(
const ffi::Array<Any>& inputs,
const ffi::Array<Any>& attrs,
56 const Any& decision,
const ffi::Array<ffi::String>& outputs)>;
113 namespace refl = tvm::ffi::reflection;
114 refl::ObjectDef<InstructionKindObj>()
130 explicit InstructionKind(ffi::UnsafeInit tag, ffi::ObjectPtr<InstructionKindObj> data)
131 : ffi::ObjectRef(tag) {
132 data_ = std::move(data);
180 namespace refl = tvm::ffi::reflection;
181 refl::ObjectDef<InstructionNode>()
204 ffi::Array<Any> outputs);
222 get_mutable()->
is_pure = is_pure;
240 get_mutable()->
f_as_python = std::move(f_as_python);
267 InstructionKind inst_kind_;
Temporary builder for a canonical named instruction kind.
Definition instruction.h:210
InstructionKindDef & set_attrs_as_json(FInstructionAttrsAsJSON f_attrs_as_json)
Set the optional JSON serialization callback.
Definition instruction.h:248
InstructionKindDef & set_as_python(FInstructionAsPython f_as_python)
Set the Python trace formatting callback.
Definition instruction.h:239
InstructionKindDef & set_attrs_from_json(FInstructionAttrsFromJSON f_attrs_from_json)
Set the optional JSON deserialization callback.
Definition instruction.h:257
InstructionKindDef(const ffi::String &name)
Find or create the canonical kind and assign its name.
InstructionKindDef & set_is_pure(bool is_pure)
Set whether removing this instruction leaves schedule state unchanged.
Definition instruction.h:221
InstructionKindDef & set_apply_to_schedule(FInstructionApply f_apply_to_schedule)
Set the schedule application callback.
Definition instruction.h:230
Kind of an instruction, e.g. Split, Reorder, etc. Besides the name, every kind of instruction has its...
Definition instruction.h:86
FInstructionAttrsAsJSON f_attrs_as_json
A functor that serialize its attributes to JSON.
Definition instruction.h:105
ffi::String name
The name of a kind of instructions.
Definition instruction.h:89
bool IsPostproc() const
Checks if the instruction kind is EnterPostproc.
FInstructionApply f_apply_to_schedule
A functor that applies the instruction to a TensorIR schedule.
Definition instruction.h:98
FInstructionAttrsFromJSON f_attrs_from_json
A functor that deserialize its attributes from JSON.
Definition instruction.h:110
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.InstructionKind", InstructionKindObj, ffi::Object)
static void RegisterReflection()
Definition instruction.h:112
bool is_pure
Indicates if the instruction is pure, i.e. removing it alone doesn't mutate the schedule state....
Definition instruction.h:96
FInstructionAsPython f_as_python
A functor that converts the instruction to a statement in python syntax.
Definition instruction.h:100
Managed reference to InstructionKindObj.
Definition instruction.h:128
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(InstructionKind, ffi::ObjectRef, InstructionKindObj)
static InstructionKind Get(const ffi::String &name)
Retrieve an InstructionKind using its name.
InstructionKind(ffi::UnsafeInit tag, ffi::ObjectPtr< InstructionKindObj > data)
Definition instruction.h:130
Schedule instructions each corresponds to a schedule primitive.
Definition instruction.h:146
InstructionKind kind
The kind of the instruction.
Definition instruction.h:152
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.Instruction", InstructionNode, ffi::Object)
InstructionNode(ffi::UnsafeInit tag)
Definition instruction.h:148
InstructionNode(InstructionKind kind)
Definition instruction.h:150
static void RegisterReflection()
Definition instruction.h:179
ffi::Array< Any > attrs
The attributes of the instruction. Similar to attributes of an operator, attributes of an instruction...
Definition instruction.h:170
ffi::Array< Any > inputs
The input random variables of the instruction, and the type of each element can be one of the followi...
Definition instruction.h:164
ffi::Array< Any > outputs
The output random variables of the instruction, and the type of each element can be one of the follow...
Definition instruction.h:177
Managed reference to InstructionNode.
Definition instruction.h:194
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(Instruction, ffi::ObjectRef, InstructionNode)
Instruction(InstructionKind kind, ffi::Array< Any > inputs, ffi::Array< Any > attrs, ffi::Array< Any > outputs)
Constructor.
Managed reference to ScheduleObj.
Definition schedule.h:887
ffi::TypedFunction< ffi::Array< Any >(Schedule sch, const ffi::Array< Any > &inputs, const ffi::Array< Any > &attrs, const Any &decision)> FInstructionApply
Type of the functor that applies the instruction to a TensorIR schedule.
Definition instruction.h:44
ffi::TypedFunction< ffi::String(const ffi::Array< Any > &inputs, const ffi::Array< Any > &attrs, const Any &decision, const ffi::Array< ffi::String > &outputs)> FInstructionAsPython
Type of the functor that converts the instruction to a statement in python syntax.
Definition instruction.h:56
ffi::TypedFunction< ffi::ObjectRef(ffi::Array< Any > attrs)> FInstructionAttrsAsJSON
Type of the functor that serialize its attributes to JSON.
Definition instruction.h:64
ffi::TypedFunction< ffi::Array< Any >(ffi::ObjectRef json_attrs)> FInstructionAttrsFromJSON
Type of the functor that deserialize its attributes from JSON.
Definition instruction.h:72
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23