19 #ifndef TVM_TIR_SCHEDULE_INSTRUCTION_H_
20 #define TVM_TIR_SCHEDULE_INSTRUCTION_H_
22 #include <tvm/ffi/reflection/registry.h>
29 template <
typename,
typename>
46 Schedule sch,
const Array<Any>& inputs,
const Array<Any>& attrs,
const Any& decision)>;
57 ffi::TypedFunction<String(
const Array<Any>& inputs,
const Array<Any>& attrs,
58 const Any& decision,
const Array<String>& outputs)>;
116 refl::ObjectDef<InstructionKindNode>()
124 static constexpr
const char*
_type_key =
"tir.InstructionKind";
176 refl::ObjectDef<InstructionNode>()
183 static constexpr
const char*
_type_key =
"tir.Instruction";
211 #define TVM_INST_KIND_REGISTER_VAR_DEF \
212 static DMLC_ATTRIBUTE_UNUSED ::tvm::tir::InstructionKindRegEntry& __make_##InstructionKind
231 #define TVM_REGISTER_INST_KIND(InstructionKindName) \
232 TVM_STR_CONCAT(TVM_INST_KIND_REGISTER_VAR_DEF, __COUNTER__) = \
233 ::tvm::tir::InstructionKindRegEntry::RegisterOrGet(InstructionKindName).set_name()
241 get_mutable()->
name = this->name;
246 get_mutable()->
is_pure = is_pure;
256 get_mutable()->
f_as_python = std::move(f_as_python);
282 template <
typename,
typename>
283 friend class ::tvm::AttrRegistry;
Definition: instruction.h:30
Kind of an instruction, e.g. Split, Reorder, etc. Besides the name, every kind of instruction has its...
Definition: instruction.h:88
String name
The name of a kind of instructions.
Definition: instruction.h:91
TVM_DECLARE_FINAL_OBJECT_INFO(InstructionKindNode, runtime::Object)
FInstructionApply f_apply_to_schedule
A functor that applies the instruction to a TensorIR schedule.
Definition: instruction.h:100
bool IsPostproc() const
Checks if the instruction kind is EnterPostproc.
FInstructionAttrsAsJSON f_attrs_as_json
A functor that serialize its attributes to JSON.
Definition: instruction.h:107
static constexpr const char * _type_key
Definition: instruction.h:124
static void RegisterReflection()
Definition: instruction.h:114
FInstructionAttrsFromJSON f_attrs_from_json
A functor that deserialize its attributes from JSON.
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:98
FInstructionAsPython f_as_python
A functor that converts the instruction to a statement in python syntax.
Definition: instruction.h:102
An entry in the registry of InstructionKind.
Definition: instruction.h:236
InstructionKindRegEntry & set_attrs_from_json(FInstructionAttrsFromJSON f_attrs_from_json)
Definition: instruction.h:265
InstructionKindRegEntry & set_attrs_as_json(FInstructionAttrsAsJSON f_attrs_as_json)
Definition: instruction.h:260
InstructionKindRegEntry & set_apply_to_schedule(FInstructionApply f_apply_to_schedule)
Definition: instruction.h:250
static InstructionKindRegEntry & RegisterOrGet(const String &name)
InstructionKindRegEntry & set_name()
Definition: instruction.h:240
InstructionKindRegEntry & set_as_python(FInstructionAsPython f_as_python)
Definition: instruction.h:255
InstructionKindRegEntry & set_is_pure(bool is_pure)
Definition: instruction.h:245
friend class InstructionKind
Definition: instruction.h:284
Managed reference to InstructionKindNode.
Definition: instruction.h:132
static InstructionKind Get(const String &name)
Retrieve an InstructionKind using its name.
TVM_DEFINE_OBJECT_REF_METHODS(InstructionKind, runtime::ObjectRef, InstructionKindNode)
Schedule instructions each corresponds to a schedule primitive.
Definition: instruction.h:144
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:159
Array< Any > attrs
The attributes of the instruction. Similar to attributes of an operator, attributes of an instruction...
Definition: instruction.h:165
InstructionKind kind
The kind of the instruction.
Definition: instruction.h:147
static constexpr const char * _type_key
Definition: instruction.h:183
TVM_DECLARE_FINAL_OBJECT_INFO(InstructionNode, runtime::Object)
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:172
static void RegisterReflection()
Definition: instruction.h:174
Managed reference to InstructionNode.
Definition: instruction.h:191
Instruction(InstructionKind kind, Array< Any > inputs, Array< Any > attrs, Array< Any > outputs)
Constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Instruction, runtime::ObjectRef, InstructionNode)
Managed reference to ScheduleNode.
Definition: schedule.h:880
Definition: repr_printer.h:91
ffi::TypedFunction< Array< Any >(ObjectRef json_attrs)> FInstructionAttrsFromJSON
Type of the functor that deserialize its attributes from JSON.
Definition: instruction.h:74
ffi::TypedFunction< ObjectRef(Array< Any > attrs)> FInstructionAttrsAsJSON
Type of the functor that serialize its attributes to JSON.
Definition: instruction.h:66
ffi::TypedFunction< Array< Any >(Schedule sch, const Array< Any > &inputs, const Array< Any > &attrs, const Any &decision)> FInstructionApply
Type of the functor that applies the instruction to a TensorIR schedule.
Definition: instruction.h:46
ffi::TypedFunction< String(const Array< Any > &inputs, const Array< Any > &attrs, const Any &decision, const Array< String > &outputs)> FInstructionAsPython
Type of the functor that converts the instruction to a statement in python syntax.
Definition: instruction.h:58
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37