|
tvm
|
Managed reference to ScheduleRuleObj. More...
#include <schedule_rule.h>
Public Types | |
| using | FInitializeWithTuneContext = ffi::TypedFunction< void(const TuneContext &)> |
The function type of InitializeWithTuneContext method. | |
| using | FApply = ffi::TypedFunction< ffi::Array< s_tir::Schedule >(const s_tir::Schedule &, const s_tir::SBlockRV &)> |
The function type of Apply method. | |
| using | FClone = ffi::TypedFunction< ScheduleRule()> |
The function type of Clone method. | |
Public Member Functions | |
| ScheduleRule (ffi::UnsafeInit tag, ffi::ObjectPtr< ScheduleRuleObj > data) | |
| TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE (ScheduleRule, ffi::ObjectRef, ScheduleRuleObj) | |
Static Public Member Functions | |
| static ScheduleRule | ApplyCustomRule () |
Create a rule that applies customized rules registered using block attribute schedule_rule. The rule will be dispatched according to target keys. | |
| static bool | IsApplyCustomRule (const ScheduleRule &rule) |
Check if the rule is ApplyCustomRule | |
| static ScheduleRule | AutoInline (bool into_producer, bool into_consumer, bool inline_const_tensor, bool disallow_if_then_else, bool require_injective, bool require_ordered, ffi::Optional< ffi::Array< ffi::String > > disallow_op) |
| Create an auto-inline rule that inlines spatial blocks if it satisfies some conditions. | |
| static ScheduleRule | InlineConstantScalars () |
| Inline blocks that produce a constant scalar. Such blocks get in the way of ReverseComputeInline during AutoInline, since they are also counted as a producer block unless they are inlined first. So it is recommended to run InlineConstantScalars before AutoInline. | |
| static ScheduleRule | MultiLevelTiling (ffi::String structure, ffi::Optional< ffi::Array< ffi::String > > tile_binds, ffi::Optional< int64_t > max_innermost_factor, ffi::Optional< ffi::Array< int64_t > > vector_load_lens, ffi::Optional< ffi::Map< ffi::String, ffi::Any > > reuse_read, ffi::Optional< ffi::Map< ffi::String, ffi::Any > > reuse_write, ffi::Optional< ffi::Function > filter_fn=std::nullopt) |
| Create a mega rule: multi-level tiling with data reuse. | |
| static ScheduleRule | MultiLevelTilingWithIntrin (ffi::String intrin_name, ffi::String structure, ffi::Optional< ffi::Array< ffi::String > > tile_binds, ffi::Optional< int64_t > max_innermost_factor, ffi::Optional< ffi::Array< int64_t > > vector_load_lens, ffi::Optional< ffi::Map< ffi::String, ffi::Any > > reuse_read, ffi::Optional< ffi::Map< ffi::String, ffi::Any > > reuse_write) |
| Extension of MultiLevelTiling for auto-tensorization with a single intrinsic. | |
| static ScheduleRule | MultiLevelTilingWideVector (ffi::String structure, int64_t vector_length_in_bits, ffi::Optional< int64_t > max_innermost_factor, ffi::Optional< ffi::Map< ffi::String, ffi::Any > > reuse_read, ffi::Optional< ffi::Map< ffi::String, ffi::Any > > reuse_write) |
| Extension of MultiLevelTiling for backends with wide vectors. The loop over the innermost spatial axis of the output tensor is always vectorized with the maximum vector length. | |
| static ScheduleRule | AddRFactor (int max_jobs_per_core, ffi::Optional< int64_t > max_innermost_factor) |
| Create a rule: add-rfactor to some blocks if needed. | |
| static ScheduleRule | CrossThreadReduction (ffi::Array< int64_t > thread_extents) |
| Create a schedule rule which applies cross-thread reduction to some reduction blocks correspondingly when needed. | |
| static ScheduleRule | RandomComputeLocation () |
| A rule that randomly select a compute-at location for a free block. | |
| static ScheduleRule | ParallelizeVectorizeUnroll (int max_jobs_per_core, int max_vectorize_extent, ffi::Array< int64_t > 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. | |
| static ScheduleRule | AutoBind (int max_threadblocks, ffi::Array< int64_t > thread_extents, int max_threads_per_block=-1) |
| Auto bind loops around the block to BlockIdx and ThreadIdx. | |
| static ScheduleRule | PyScheduleRule (FInitializeWithTuneContext f_initialize_with_tune_context, FApply f_apply, FClone f_clone) |
| Create a schedule rule with customized methods on the python-side. | |
| static ffi::Array< ScheduleRule, void > | DefaultLLVM () |
| Create default schedule rules for LLVM. | |
| static ffi::Array< ScheduleRule, void > | DefaultX86 (const ffi::String &type) |
| Create default schedule rules for x86 (AVX512 and VNNI) | |
| static ffi::Array< ScheduleRule, void > | DefaultCUDA () |
| Create default schedule rules for CUDA. | |
| static ffi::Array< ScheduleRule, void > | DefaultHexagon () |
| Create default schedule rules for Hexagon. | |
| static ffi::Array< ScheduleRule, void > | DefaultARM (const ffi::String &type) |
| Create default schedule rules for ARM CPU (NEON and DOTPROD) | |
| static ffi::Array< ScheduleRule, void > | DefaultRISCV (Target target, int vlen) |
| Create default schedule rules for RISCV CPU (RVV) | |
Managed reference to ScheduleRuleObj.
| using tvm::s_tir::meta_schedule::ScheduleRule::FApply = ffi::TypedFunction<ffi::Array<s_tir::Schedule>(const s_tir::Schedule&, const s_tir::SBlockRV&)> |
The function type of Apply method.
| sch | The schedule to be modified. |
| block | The specific block to apply the schedule rule. |
| using tvm::s_tir::meta_schedule::ScheduleRule::FClone = ffi::TypedFunction<ScheduleRule()> |
The function type of Clone method.
| using tvm::s_tir::meta_schedule::ScheduleRule::FInitializeWithTuneContext = ffi::TypedFunction<void(const TuneContext&)> |
The function type of InitializeWithTuneContext method.
| context | The tuning context for initialization. |
|
inlineexplicit |
|
static |
Create a rule: add-rfactor to some blocks if needed.
| max_jobs_per_core | The 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_factor | The maximum size of the innermost factor. std::nullopt means no limit |
|
static |
Create a rule that applies customized rules registered using block attribute schedule_rule. The rule will be dispatched according to target keys.
|
static |
Auto bind loops around the block to BlockIdx and ThreadIdx.
| max_threadblocks | The maximum number of threadblock on GPU |
| thread_extents | Candidates of thread axis extent. |
| max_threads_per_block | The maximum number of threads per block, if it is known when this schedule rule is created. |
|
static |
Create an auto-inline rule that inlines spatial blocks if it satisfies some conditions.
| into_producer | If allows to inline a block into its producer |
| into_consumer | If allows to inline a block into its consumer |
| inline_const_tensor | Always inline constant tensors |
| disallow_if_then_else | Always disallow if-then-else-like constructs |
| require_ordered | Always require the read-to-write mapping to be ordered |
| require_injective | Always require the read-to-write mapping to be injective |
| disallow_op | The operators that are disallowed in auto inline |
|
static |
Create a schedule rule which applies cross-thread reduction to some reduction blocks correspondingly when needed.
| thread_extents | Candidates of thread axis extent (values are required to be positive). |
|
static |
Create default schedule rules for ARM CPU (NEON and DOTPROD)
|
static |
Create default schedule rules for CUDA.
|
static |
Create default schedule rules for Hexagon.
|
static |
Create default schedule rules for LLVM.
|
static |
Create default schedule rules for RISCV CPU (RVV)
|
static |
Create default schedule rules for x86 (AVX512 and VNNI)
|
static |
Inline blocks that produce a constant scalar. Such blocks get in the way of ReverseComputeInline during AutoInline, since they are also counted as a producer block unless they are inlined first. So it is recommended to run InlineConstantScalars before AutoInline.
|
static |
Check if the rule is ApplyCustomRule
|
static |
Create a mega rule: multi-level tiling with data reuse.
| structure | The tiling structure. Recommended:
|
| tile_binds | For each level of tiles, which thread axis it is bound to. Recommended:
|
| max_innermost_factor | The maximum size of the innermost factor. std::nullopt means no limit |
| vector_load_lens | The length of vector lane in vectorized cooperative fetching. std::nullopt means disable vectorization |
| reuse_read | Data reuse configuration for reading. std::nullopt means no reuse. |
| reuse_write | Data reuse configuration for writing. std::nullopt means no reuse. |
| filter_fn | A function that can be passed to overwrite the default condition for applying MultiLevelTiling to a block. Its signature must be (Schedule, SBlockRV) -> bool. This is useful if there is a need to apply MultiLevelTiling to an operation / block which is ignored by default. This function should return True for a block that should be tiled. |
|
static |
Extension of MultiLevelTiling for backends with wide vectors. The loop over the innermost spatial axis of the output tensor is always vectorized with the maximum vector length.
| structure | The tiling structure. 'SSRSRS' is recommended. |
| vector_length_in_bits | The length of a vector register in bits. |
| max_innermost_factor | The maximum size of the innermost factor. std::nullopt means no limit |
| reuse_read | Data reuse configuration for reading. std::nullopt means no reuse. |
| reuse_write | Data reuse configuration for writing. std::nullopt means no reuse. |
|
static |
Extension of MultiLevelTiling for auto-tensorization with a single intrinsic.
| intrin_name | The name of a tensor intrinsic, must be registered via TensorIntrin.register(...) beforehand |
| structure | The tiling structure. Recommended:
|
| tile_binds | For each level of tiles, which thread axis it is bound to. Recommended:
|
| max_innermost_factor | The maximum size of the innermost factor. std::nullopt means no limit |
| vector_load_lens | The length of vector lane in vectorized cooperative fetching. std::nullopt means disable vectorization |
| reuse_read | Data reuse configuration for reading. std::nullopt means no reuse. |
| reuse_write | Data reuse configuration for writing. std::nullopt means no reuse. |
|
static |
Mark parallelize, vectorize and unroll to the root block. The mark will be applied to each block in a follow-up post processor.
| max_jobs_per_core | The 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_extent | The maximum extent to be vectorized. It sets the upper limit of the hardware target vectorization. Use -1 to disable vectorization. |
| unroll_max_steps | The options of the maximum number of unroll steps to be done. Use an empty array to disable unroll. |
| unroll_explicit | Whether to explicitly unroll the loop, or just add an "unroll" pragma. |
|
static |
Create a schedule rule with customized methods on the python-side.
| f_initialize_with_tune_context | The packed function of InitializeWithTuneContext. |
| f_apply | The packed function of Apply. |
| f_clone | The packed function of Clone. |
|
static |
A rule that randomly select a compute-at location for a free block.
| tvm::s_tir::meta_schedule::ScheduleRule::TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE | ( | ScheduleRule | , |
| ffi::ObjectRef | , | ||
| ScheduleRuleObj | |||
| ) |