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,
317 bool preserve_unit_iters =
true) = 0;
330 virtual void Reorder(
const Array<LoopRV>& ordered_loop_rvs) = 0;
363 virtual void Vectorize(
const LoopRV& loop_rv) = 0;
392 virtual BlockRV CacheRead(
const BlockRV& block_rv,
int read_buffer_index,
393 const String& storage_scope,
404 virtual BlockRV CacheWrite(
const BlockRV& block_rv,
int write_buffer_index,
405 const String& storage_scope) = 0;
417 virtual BlockRV ReIndex(
const BlockRV& block_rv,
int buffer_index,
440 virtual void ComputeAt(
const BlockRV& block_rv,
const LoopRV& loop_rv,
bool preserve_unit_loops,
461 virtual void ReverseComputeAt(
const BlockRV& block_rv,
const LoopRV& loop_rv,
462 bool preserve_unit_loops,
int index = -1) = 0;
473 virtual void ComputeInline(
const BlockRV& block) = 0;
485 virtual void ReverseComputeInline(
const BlockRV& block) = 0;
520 virtual BlockRV RFactor(
const LoopRV& loop_rv,
int factor_axis) = 0;
534 virtual void StorageAlign(
const BlockRV& block_rv,
int buffer_index,
int axis,
int factor,
543 virtual void SetScope(
const BlockRV& block_rv,
int buffer_index,
const String& storage_scope) = 0;
556 virtual void Tensorize(
const LoopRV& loop_rv,
const String& intrin) = 0;
562 virtual void Tensorize(
const BlockRV& block_rv,
const String& intrin) = 0;
578 virtual void Annotate(
const BlockRV& block_rv,
const String& ann_key,
585 virtual void Unannotate(
const LoopRV& loop_rv,
const String& ann_key) = 0;
591 virtual void Unannotate(
const BlockRV& block_rv,
const String& ann_key) = 0;
619 virtual void TransformLayout(
const BlockRV& block_rv,
int buffer_index,
631 virtual void TransformBlockLayout(
const BlockRV& block_rv,
const IndexMap& index_map) = 0;
641 virtual void SetAxisSeparator(
const BlockRV& block_rv,
int buffer_index,
676 virtual void EnterPostproc() = 0;
732 #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:1295
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:1002
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:694
Defines a remapping of buffer indices.
int64_t TRandState
Definition: random_engine.h:54
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:167
Container of all statements.
Definition: stmt.h:57
Reference to string objects.
Definition: string.h:97
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:190
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:1428
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:352
A random variable that evaluates to a TensorIR for loop.
Definition: schedule.h:72
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:112
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
constexpr runtime::NullOptType NullOpt
Definition: optional.h:160
std::vector< std::string > Split(const std::string &str, const std::string &sub)
Split str according to substring.
Definition: einsum.h:425
#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