19 #ifndef TVM_TIR_SCHEDULE_SCHEDULE_H_ 20 #define TVM_TIR_SCHEDULE_SCHEDULE_H_ 54 static constexpr
const char* _type_key =
"tir.BlockRV";
75 static constexpr
const char* _type_key =
"tir.LoopRV";
108 static constexpr
const char* _type_key =
"tir.Schedule";
132 virtual void WorkOn(
const String& func_name) = 0;
163 virtual For Get(
const LoopRV& loop_rv)
const = 0;
187 virtual bool HasBlock(
const BlockRV& block_rv)
const = 0;
204 virtual void RemoveRV(
const BlockRV& block_rv) = 0;
209 virtual void RemoveRV(
const LoopRV& loop_rv) = 0;
214 virtual void RemoveRV(
const ExprRV& expr_rv) = 0;
235 virtual Array<ExprRV> SamplePerfectTile(
const LoopRV& loop_rv,
int n,
int max_innermost_factor,
243 virtual LoopRV SampleComputeLocation(
const BlockRV& block_rv,
336 bool preserve_unit_iters =
true) = 0;
349 virtual void Reorder(
const Array<LoopRV>& ordered_loop_rvs) = 0;
388 virtual void Vectorize(
const LoopRV& loop_rv) = 0;
417 virtual BlockRV CacheRead(
const BlockRV& block_rv,
int read_buffer_index,
418 const String& storage_scope,
430 virtual BlockRV CacheWrite(
const BlockRV& block_rv,
int write_buffer_index,
431 const String& storage_scope,
445 virtual BlockRV ReindexCacheRead(
const BlockRV& block_rv,
int read_buffer_index,
459 virtual BlockRV ReindexCacheWrite(
const BlockRV& block_rv,
int write_buffer_index,
470 const String& storage_scope) = 0;
492 virtual BlockRV ReIndex(
const BlockRV& block_rv,
int buffer_index,
496 const String& storage_scope) = 0;
498 const String& storage_scope) = 0;
520 virtual void ComputeAt(
const BlockRV& block_rv,
const LoopRV& loop_rv,
bool preserve_unit_loops,
541 virtual void ReverseComputeAt(
const BlockRV& block_rv,
const LoopRV& loop_rv,
542 bool preserve_unit_loops,
int index = -1) = 0;
553 virtual void ComputeInline(
const BlockRV& block) = 0;
565 virtual void ReverseComputeInline(
const BlockRV& block) = 0;
600 virtual BlockRV RFactor(
const LoopRV& loop_rv,
int factor_axis) = 0;
614 virtual void StorageAlign(
const BlockRV& block_rv,
int buffer_index,
int axis,
int factor,
623 virtual void SetScope(
const BlockRV& block_rv,
int buffer_index,
const String& storage_scope) = 0;
633 virtual void UnsafeSetDType(
const BlockRV& block_rv,
int buffer_index,
const String& dtype) = 0;
641 virtual BlockRV Blockize(
const LoopRV& loop_rv,
bool preserve_unit_iters =
true) = 0;
648 virtual void Tensorize(
const LoopRV& loop_rv,
const String& intrin,
649 bool preserve_unit_iters =
true) = 0;
656 virtual void Tensorize(
const BlockRV& block_rv,
const String& intrin,
657 bool preserve_unit_iters =
true) = 0;
673 virtual void Annotate(
const BlockRV& block_rv,
const String& ann_key,
680 virtual void Unannotate(
const LoopRV& loop_rv,
const String& ann_key) = 0;
686 virtual void Unannotate(
const BlockRV& block_rv,
const String& ann_key) = 0;
720 virtual void TransformLayout(
const BlockRV& block_rv,
int buffer_index,
723 bool assume_injective_transform =
false) = 0;
733 virtual void TransformBlockLayout(
const BlockRV& block_rv,
const IndexMap& index_map) = 0;
743 virtual void SetAxisSeparator(
const BlockRV& block_rv,
int buffer_index,
791 virtual void RollingBuffer(
const BlockRV& block_rv,
int write_buffer_index) = 0;
795 virtual void EnterPostproc() = 0;
830 bool enable_check =
true);
847 bool enable_check =
true);
854 #endif // TVM_TIR_SCHEDULE_SCHEDULE_H_ IterVar thread_axis(Range dom, std::string tag)
Create a new IterVar that represents an axis in thread.
ForFrame Unroll(PrimExpr start, PrimExpr stop, Optional< Map< String, ObjectRef >> annotations=NullOpt)
The unrolled For statement.
Base node of all statements.
Definition: stmt.h:38
void VisitAttrs(tvm::AttrVisitor *v)
Definition: schedule.h:53
Managed reference to BlockNode.
Definition: stmt.h:1258
Random number generator. It provides a generic interface consistent with std::uniform_random_bit_gene...
Type Bind(const Type &type, const Map< TypeVar, Type > &args_map)
Bind free type variables in the type.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Managed reference to LoopRVNode.
Definition: schedule.h:83
Index of a written buffer.
Managed reference to ForNode.
Definition: stmt.h:962
StmtSRef GetSRef(const Stmt &stmt) const
Get the block/loop sref corresponding to the specific statement.
Definition: schedule.h:199
Managed reference to StmtSRefNode.
Definition: block_scope.h:102
base class of all object containers.
Definition: object.h:167
#define TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:744
ScheduleErrorRenderLevel
The level of detailed error message rendering.
Definition: schedule.h:31
Render a detailed error message.
Managed reference to ScheduleNode.
Definition: schedule.h:813
Defines a remapping of buffer indices.
int64_t TRandState
Definition: random_engine.h:46
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
Definition: index_map.h:177
Container of all statements.
Definition: stmt.h:59
Reference to string objects.
Definition: string.h:98
Render the error in fast mode.
const Object * get() const
Definition: object.h:546
The user-facing schedule class.
Definition: schedule.h:102
Managed reference to ScheduleStateNode.
Definition: state.h:196
ForFrame Parallel(PrimExpr start, PrimExpr stop, Optional< Map< String, ObjectRef >> annotations=NullOpt)
The parallel For statement.
Base class of all object reference.
Definition: object.h:511
virtual IRModule mod() const
Get the IRModule associated with this schedule.
Definition: schedule.h:113
constexpr const char * axis_separators
Marks the physical axis separators.
Definition: stmt.h:1391
This file defines ScheduleState, the core data structure of TensorIR scheduling.
#define TVM_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType)
helper macro to declare type information in a final class.
Definition: object.h:671
Managed reference class to IRModuleNode.
Definition: module.h:348
A random variable that evaluates to a TensorIR for loop.
Definition: schedule.h:72
Map< K, V > Merge(Map< K, V > lhs, const Map< K, V > &rhs)
Merge two Maps.
Definition: map.h:1471
A random variable that evaluates to a TensorIR block.
Definition: schedule.h:51
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
BufferIndexType
Type of buffer index.
Definition: schedule.h:41
void VisitAttrs(tvm::AttrVisitor *v)
Definition: schedule.h:74
Reference to PrimExprNode.
Definition: expr.h:114
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
constexpr runtime::NullOptType NullOpt
Definition: optional.h:160
#define TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:728
Managed reference to BlockRVNode.
Definition: schedule.h:62
Base node of all primitive expressions.
Definition: expr.h:85