tvm
Public Member Functions | Static Public Member Functions | List of all members
tvm::meta_schedule::ScheduleRule Class Reference

Managed reference to ScheduleRuleNode. More...

#include <schedule_rule.h>

Inheritance diagram for tvm::meta_schedule::ScheduleRule:
Collaboration diagram for tvm::meta_schedule::ScheduleRule:

Public Member Functions

 TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS (ScheduleRule, ObjectRef, ScheduleRuleNode)
 
- Public Member Functions inherited from tvm::runtime::ObjectRef
 ObjectRef ()=default
 default constructor More...
 
 ObjectRef (ObjectPtr< Object > data)
 Constructor from existing object ptr. More...
 
bool same_as (const ObjectRef &other) const
 Comparator. More...
 
bool operator== (const ObjectRef &other) const
 Comparator. More...
 
bool operator!= (const ObjectRef &other) const
 Comparator. More...
 
bool operator< (const ObjectRef &other) const
 Comparator. More...
 
bool defined () const
 
const Objectget () const
 
const Objectoperator-> () const
 
bool unique () const
 
int use_count () const
 
template<typename ObjectType >
const ObjectType * as () const
 Try to downcast the internal Object to a raw pointer of a corresponding type. More...
 

Static Public Member Functions

static ScheduleRule AutoInline (bool into_producer, bool into_consumer, bool inline_const_tensor, bool disallow_if_then_else, bool require_injective, bool require_ordered, Optional< Array< String >> disallow_op)
 Create an auto-inline rule that inlines spatial blocks if it satisfies some conditions. More...
 
static ScheduleRule MultiLevelTiling (String structure, Optional< Array< String >> tile_binds, Optional< Integer > max_innermost_factor, Optional< Array< Integer >> vector_load_lens, Optional< Map< String, ObjectRef >> reuse_read, Optional< Map< String, ObjectRef >> reuse_write)
 Create a mega rule: multi-level tiling with data reuse. More...
 
static ScheduleRule MultiLevelTilingWithIntrin (String intrin_name, String structure, Optional< Array< String >> tile_binds, Optional< Integer > max_innermost_factor, Optional< Array< Integer >> vector_load_lens, Optional< Map< String, ObjectRef >> reuse_read, Optional< Map< String, ObjectRef >> reuse_write)
 Extension of MultiLevelTiling for auto-tensorizing with a single intrinsic. More...
 
static ScheduleRule AddRFactor (int max_jobs_per_core, Optional< Integer > max_innermost_factor)
 Create a rule: add-rfactor to some blocks if needed. More...
 
static ScheduleRule CrossThreadReduction (Array< Integer > thread_extents)
 Create a schedule rule which applies cross-thread reduction to some reduction blocks correspondingly when needed. More...
 
static ScheduleRule RandomComputeLocation ()
 A rule that randomly select a compute-at location for a free block. More...
 
static ScheduleRule ParallelizeVectorizeUnroll (int max_jobs_per_core, int max_vectorize_extent, Array< Integer > unroll_max_steps, bool unroll_explicit)
 Mark parallelize, vectorize and unroll to the root block. The mark will be applied to each block in a follow-up post processor. More...
 
static ScheduleRule AutoBind (int max_threadblocks, Array< Integer > thread_extents)
 Auto bind loops around the block to BlockIdx and ThreadIdx. More...
 
static ScheduleRule PyScheduleRule (PyScheduleRuleNode::FInitializeWithTuneContext f_initialize_with_tune_context, PyScheduleRuleNode::FApply f_apply, PyScheduleRuleNode::FAsString f_as_string)
 Create a schedule rule with customized methods on the python-side. More...
 

Additional Inherited Members

- Public Types inherited from tvm::runtime::ObjectRef
using ContainerType = Object
 type indicate the container type. More...
 
- Static Public Attributes inherited from tvm::runtime::ObjectRef
static constexpr bool _type_is_nullable = true
 
- Protected Member Functions inherited from tvm::runtime::ObjectRef
Objectget_mutable () const
 
- Static Protected Member Functions inherited from tvm::runtime::ObjectRef
template<typename T >
static T DowncastNoCheck (ObjectRef ref)
 Internal helper function downcast a ref without check. More...
 
static void FFIClearAfterMove (ObjectRef *ref)
 Clear the object ref data field without DecRef after we successfully moved the field. More...
 
template<typename ObjectType >
static ObjectPtr< ObjectType > GetDataPtr (const ObjectRef &ref)
 Internal helper function get data_ as ObjectPtr of ObjectType. More...
 
- Protected Attributes inherited from tvm::runtime::ObjectRef
ObjectPtr< Objectdata_
 Internal pointer that backs the reference. More...
 

Detailed Description

Managed reference to ScheduleRuleNode.

See also
ScheduleRuleNode

Member Function Documentation

◆ AddRFactor()

static ScheduleRule tvm::meta_schedule::ScheduleRule::AddRFactor ( int  max_jobs_per_core,
Optional< Integer max_innermost_factor 
)
static

Create a rule: add-rfactor to some blocks if needed.

Parameters
max_jobs_per_coreThe maximum number of jobs to be launched per CPU core. It sets the uplimit of CPU parallelism, i.e. num_cores * max_jobs_per_core. Use -1 to disable parallelism.
max_innermost_factorThe maximum size of the innermost factor. NullOpt means no limit
Returns
The schedule rule created

◆ AutoBind()

static ScheduleRule tvm::meta_schedule::ScheduleRule::AutoBind ( int  max_threadblocks,
Array< Integer thread_extents 
)
static

Auto bind loops around the block to BlockIdx and ThreadIdx.

Parameters
max_threadblocksThe maximum number of threadblock on GPU
thread_extentsCandidates of thread axis extent.
Returns
The schedule rule created

◆ AutoInline()

static ScheduleRule tvm::meta_schedule::ScheduleRule::AutoInline ( bool  into_producer,
bool  into_consumer,
bool  inline_const_tensor,
bool  disallow_if_then_else,
bool  require_injective,
bool  require_ordered,
Optional< Array< String >>  disallow_op 
)
static

Create an auto-inline rule that inlines spatial blocks if it satisfies some conditions.

Parameters
into_producerIf allows to inline a block into its producer
into_consumerIf allows to inline a block into its consumer
inline_const_tensorAlways inline constant tensors
disallow_if_then_elseAlways disallow if-then-else-like constructs
require_orderedAlways require the read-to-write mapping to be ordered
require_injectiveAlways require the read-to-write mapping to be injective
disallow_opThe operators that are disallowed in auto inline
Returns
The schedule rule created

◆ CrossThreadReduction()

static ScheduleRule tvm::meta_schedule::ScheduleRule::CrossThreadReduction ( Array< Integer thread_extents)
static

Create a schedule rule which applies cross-thread reduction to some reduction blocks correspondingly when needed.

Parameters
thread_extentsCandidates of thread axis extent (values are required to be positive).
Returns
The schedule rule created

◆ MultiLevelTiling()

static ScheduleRule tvm::meta_schedule::ScheduleRule::MultiLevelTiling ( String  structure,
Optional< Array< String >>  tile_binds,
Optional< Integer max_innermost_factor,
Optional< Array< Integer >>  vector_load_lens,
Optional< Map< String, ObjectRef >>  reuse_read,
Optional< Map< String, ObjectRef >>  reuse_write 
)
static

Create a mega rule: multi-level tiling with data reuse.

Parameters
structureThe tiling structure. Recommended:
  • 'SSRSRS' on CPU
  • 'SSSRRSRS' on GPU
tile_bindsFor each level of tiles, which thread axis it is bound to. Recommended:
  • NullOpt on CPU
  • [blockIdx.x, vthread.x, threadIdx.x] on GPU
max_innermost_factorThe maximum size of the innermost factor. NullOpt means no limit
vector_load_lensThe length of vector lane in vectorized cooperative fetching. NullOpt means disable vectorization
reuse_readData reuse configuration for reading. NullOpt means no reuse.
reuse_writeData reuse configuration for writing. NullOpt means no reuse.
Returns
The schedule rule created

◆ MultiLevelTilingWithIntrin()

static ScheduleRule tvm::meta_schedule::ScheduleRule::MultiLevelTilingWithIntrin ( String  intrin_name,
String  structure,
Optional< Array< String >>  tile_binds,
Optional< Integer max_innermost_factor,
Optional< Array< Integer >>  vector_load_lens,
Optional< Map< String, ObjectRef >>  reuse_read,
Optional< Map< String, ObjectRef >>  reuse_write 
)
static

Extension of MultiLevelTiling for auto-tensorizing with a single intrinsic.

Parameters
intrin_nameThe name of a tensor intrinsic, must be registerd via TensorIntrin.register(...) beforehand
structureThe tiling structure. Recommended:
  • 'SSRSRS' on CPU
  • 'SSSRRSRS' on GPU
tile_bindsFor each level of tiles, which thread axis it is bound to. Recommended:
  • NullOpt on CPU
  • [blockIdx.x, vthread.x, threadIdx.x] on GPU
max_innermost_factorThe maximum size of the innermost factor. NullOpt means no limit
vector_load_lensThe length of vector lane in vectorized cooperative fetching. NullOpt means disable vectorization
reuse_readData reuse configuration for reading. NullOpt means no reuse.
reuse_writeData reuse configuration for writing. NullOpt means no reuse.
Returns
The schedule rule created

◆ ParallelizeVectorizeUnroll()

static ScheduleRule tvm::meta_schedule::ScheduleRule::ParallelizeVectorizeUnroll ( int  max_jobs_per_core,
int  max_vectorize_extent,
Array< Integer unroll_max_steps,
bool  unroll_explicit 
)
static

Mark parallelize, vectorize and unroll to the root block. The mark will be applied to each block in a follow-up post processor.

Parameters
max_jobs_per_coreThe maximum number of jobs to be launched per CPU core. It sets the upper limit of CPU parallelism, i.e. num_cores * max_jobs_per_core. Use -1 to disable parallelism.
max_vectorize_extentThe maximum extent to be vectorized. It sets the upper limit of the hardware target vectorization. Use -1 to disable vectorization.
unroll_max_stepsThe options of the maximum number of unroll steps to be done. Use an empty array to disable unroll.
unroll_explicitWhether to explicitly unroll the loop, or just add an "unroll" pragma.
Returns
The schedule rule created

◆ PyScheduleRule()

static ScheduleRule tvm::meta_schedule::ScheduleRule::PyScheduleRule ( PyScheduleRuleNode::FInitializeWithTuneContext  f_initialize_with_tune_context,
PyScheduleRuleNode::FApply  f_apply,
PyScheduleRuleNode::FAsString  f_as_string 
)
static

Create a schedule rule with customized methods on the python-side.

Parameters
f_initialize_with_tune_contextThe packed function of InitializeWithTuneContext.
f_applyThe packed function of Apply.
f_as_stringThe packed function of AsString.
Returns
The schedule rule created.

◆ RandomComputeLocation()

static ScheduleRule tvm::meta_schedule::ScheduleRule::RandomComputeLocation ( )
static

A rule that randomly select a compute-at location for a free block.

Returns
The schedule rule created

◆ TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS()

tvm::meta_schedule::ScheduleRule::TVM_DEFINE_MUTABLE_OBJECT_REF_METHODS ( ScheduleRule  ,
ObjectRef  ,
ScheduleRuleNode   
)

The documentation for this class was generated from the following file: