19 #ifndef TVM_S_TIR_SCHEDULE_INSTRUCTION_H_
20 #define TVM_S_TIR_SCHEDULE_INSTRUCTION_H_
22 #include <tvm/ffi/reflection/registry.h>
29 template <
typename,
typename>
47 ffi::TypedFunction<ffi::Array<Any>(
Schedule sch,
const ffi::Array<Any>& inputs,
48 const ffi::Array<Any>& attrs,
const Any& decision)>;
59 ffi::TypedFunction<ffi::String(
const ffi::Array<Any>& inputs,
const ffi::Array<Any>& attrs,
60 const Any& decision,
const ffi::Array<ffi::String>& outputs)>;
117 namespace refl = tvm::ffi::reflection;
118 refl::ObjectDef<InstructionKindNode>()
175 namespace refl = tvm::ffi::reflection;
176 refl::ObjectDef<InstructionNode>()
199 ffi::Array<Any> outputs);
209 #define TVM_INST_KIND_REGISTER_VAR_DEF \
210 [[maybe_unused]] static ::tvm::s_tir::InstructionKindRegEntry& __make_##InstructionKind
229 #define TVM_REGISTER_INST_KIND(InstructionKindName) \
230 TVM_FFI_STR_CONCAT(TVM_INST_KIND_REGISTER_VAR_DEF, __COUNTER__) = \
231 ::tvm::s_tir::InstructionKindRegEntry::RegisterOrGet(InstructionKindName).set_name()
239 get_mutable()->name = this->name;
244 get_mutable()->is_pure = is_pure;
249 get_mutable()->f_apply_to_schedule = std::move(f_apply_to_schedule);
254 get_mutable()->f_as_python = std::move(f_as_python);
259 get_mutable()->f_attrs_as_json = std::move(f_attrs_as_json);
264 get_mutable()->f_attrs_from_json = std::move(f_attrs_from_json);
279 InstructionKind inst_kind_;
280 template <
typename,
typename>
281 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:90
ffi::String name
The name of a kind of instructions.
Definition: instruction.h:93
bool IsPostproc() const
Checks if the instruction kind is EnterPostproc.
bool is_pure
Indicates if the instruction is pure, i.e. removing it alone doesn't mutate the schedule state....
Definition: instruction.h:100
static void RegisterReflection()
Definition: instruction.h:116
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.InstructionKind", InstructionKindNode, ffi::Object)
An entry in the registry of InstructionKind.
Definition: instruction.h:234
static InstructionKindRegEntry & RegisterOrGet(const ffi::String &name)
InstructionKindRegEntry & set_apply_to_schedule(FInstructionApply f_apply_to_schedule)
Definition: instruction.h:248
InstructionKindRegEntry & set_attrs_as_json(FInstructionAttrsAsJSON f_attrs_as_json)
Definition: instruction.h:258
InstructionKindRegEntry & set_as_python(FInstructionAsPython f_as_python)
Definition: instruction.h:253
InstructionKindRegEntry & set_attrs_from_json(FInstructionAttrsFromJSON f_attrs_from_json)
Definition: instruction.h:263
InstructionKindRegEntry & set_is_pure(bool is_pure)
Definition: instruction.h:243
InstructionKindRegEntry & set_name()
Definition: instruction.h:238
Managed reference to InstructionKindNode.
Definition: instruction.h:132
static InstructionKind Get(const ffi::String &name)
Retrieve an InstructionKind using its name.
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(InstructionKind, ffi::ObjectRef, InstructionKindNode)
Schedule instructions each corresponds to a schedule primitive.
Definition: instruction.h:144
InstructionKind kind
The kind of the instruction.
Definition: instruction.h:147
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("s_tir.Instruction", InstructionNode, ffi::Object)
static void RegisterReflection()
Definition: instruction.h:174
ffi::Array< Any > attrs
The attributes of the instruction. Similar to attributes of an operator, attributes of an instruction...
Definition: instruction.h:165
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:159
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:172
Managed reference to InstructionNode.
Definition: instruction.h:189
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(Instruction, ffi::ObjectRef, InstructionNode)
Instruction(InstructionKind kind, ffi::Array< Any > inputs, ffi::Array< Any > attrs, ffi::Array< Any > outputs)
Constructor.
Managed reference to ScheduleNode.
Definition: schedule.h:897
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:48
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:60
ffi::TypedFunction< ffi::ObjectRef(ffi::Array< Any > attrs)> FInstructionAttrsAsJSON
Type of the functor that serialize its attributes to JSON.
Definition: instruction.h:68
ffi::TypedFunction< ffi::Array< Any >(ffi::ObjectRef json_attrs)> FInstructionAttrsFromJSON
Type of the functor that deserialize its attributes from JSON.
Definition: instruction.h:76
Definition: axis_group_graph.h:39
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37