tvm
|
Classes | |
class | TuningOptionsNode |
Tuning and measurement options. More... | |
class | TuningOptions |
Managed reference to TuningOptionsNode. More... | |
class | AccessAnalyzerNode |
Static analyzer for a ComputeDAG. More... | |
class | AccessAnalyzer |
Managed reference to AccessAnalyzerNode. More... | |
class | ComputeDAGNode |
The auto-scheduler's computational graph and related program analyses. More... | |
class | ComputeDAG |
Managed reference to ComputeDAGNode. More... | |
class | CostModelNode |
The base class for cost model. More... | |
class | CostModel |
Managed reference to CostModelNode. More... | |
class | RandomModelNode |
The cost model returning random value for all predictions. More... | |
class | RandomModel |
Managed reference to RandomModelNode. More... | |
class | PythonBasedModelNode |
A wrapper for cost model defined by python code This class will call functions defined in the python. More... | |
class | PythonBasedModel |
Managed reference to PythonBasedModelNode. More... | |
struct | StageAttributes |
Stage-level attributes. More... | |
class | StageNode |
A op stage in the compute declaration. Similar to te::Stage in include/tvm/te/schedule.h . More... | |
class | Stage |
Managed reference to StageNode. More... | |
class | AttachMapNode |
stores the compute_at relation between stages This stores a bi-directional mapping from stages and iter: More... | |
class | AttachMap |
Managed reference to AttachMapNode. More... | |
class | StateNode |
A state in the search process. It consists of the current loop structure and a list of transformation steps used to construct it. Each State corresponds to a specific schedule for its ComputeDAG. More... | |
class | State |
Managed reference to StateNode. More... | |
class | MeasureInputNode |
Store the input of a measurement. More... | |
class | MeasureInput |
Managed reference to MeasureInputNode. More... | |
class | BuildResultNode |
Store the result of a build. More... | |
class | BuildResult |
Managed reference to BuildResultNode. More... | |
class | MeasureResultNode |
Store the results of a measurement. More... | |
class | MeasureResult |
Managed reference to MeasureResultNode. More... | |
class | MeasureCallbackNode |
Bass class of measurement callbacks. More... | |
class | MeasureCallback |
Managed reference to MeasureCallbackNode. More... | |
class | PythonBasedMeasureCallbackNode |
A wrapper for measure callback defined by python code This class will call functions defined in the python. More... | |
class | PythonBasedMeasureCallback |
Managed reference to PythonBasedMeasureCallbackNode. More... | |
class | ProgramBuilderNode |
ProgramBuilder that builds the programs. More... | |
class | ProgramBuilder |
Managed reference to ProgramBuilderNode. More... | |
class | ProgramRunnerNode |
ProgramRunner that runs the built programs and measure the time cost. More... | |
class | ProgramRunner |
Managed reference to ProgramRunnerNode. More... | |
class | LocalBuilderNode |
LocalBuilder use local CPU cores to build programs in parallel. More... | |
class | LocalBuilder |
Managed reference to LocalBuilderNode. More... | |
class | LocalRunnerNode |
LocalRunner that uses local CPU/GPU to measure the time cost of programs. More... | |
class | LocalRunner |
Managed reference to LocalRunnerNode. More... | |
class | RPCRunnerNode |
RPCRunner that uses RPC call to measures the time cost of programs on remote devices. Or sometime we may need to use RPC even in local running to insulate the thread environment. (e.g. running CUDA programs) More... | |
class | RPCRunner |
Managed reference to RPCRunnerNode. More... | |
class | ProgramMeasurerNode |
Measurer that measures the time costs of tvm programs This class combines ProgramBuilder and ProgramRunner, and provides a simpler API. More... | |
class | ProgramMeasurer |
Managed reference to ProgramMeasurerNode. More... | |
class | RecordToFileNode |
Callback for logging the input and results of measurements to file. More... | |
class | RecordToFile |
Managed reference to RecordToFileNode. More... | |
class | RecordReaderNode |
Log reader to load step logs from a file. More... | |
class | RecordReader |
Managed reference to RecordReaderNode. More... | |
class | SearchCallbackNode |
Callback function to be called by the search process. This interface allows to do extra initializations before schedule search or extra check during/after the schedule search. More... | |
class | SearchCallback |
Managed reference to SearchCallbackNode. More... | |
class | PreloadMeasuredStatesNode |
Preload measured states from a log file. This can resume the state of the search policy. More... | |
class | PreloadMeasuredStates |
Managed reference to PreloadMeasuredStatesNode. More... | |
struct | SearchPolicyKey |
Attribute keys of ops used for SearchPolicy. More... | |
class | SearchPolicyNode |
The base class of search policies. More... | |
class | SearchPolicy |
Managed reference to SearchPolicyNode. More... | |
class | HardwareParamsNode |
The parameters of target hardware used to guide the SearchPolicy. More... | |
class | HardwareParams |
Managed reference to HardwareParamsNode. More... | |
class | SearchTaskNode |
The computation information and hardware parameters for a specific schedule search task. More... | |
class | SearchTask |
Managed reference to SearchTaskNode. More... | |
class | IteratorNode |
An iterator of a for-loop Similar to tvm::IterVar in include/tvm/tir/expr.h More... | |
class | Iterator |
Managed reference to IteratorNode. More... | |
class | StepNode |
The base class of transformation steps. Each step has its corresponding tvm.te schedule primitives. More... | |
class | Step |
Managed reference to StepNode. More... | |
class | AnnotationStepNode |
Annotation step that corresponds to vectorize, parallel, unroll and thread binding. (i.e. te::Stage::vectorize, te::Stage::parallel, te::Stage::vectorize, te::Stage::bind) More... | |
class | AnnotationStep |
Managed reference to AnnotationStepNode. More... | |
class | FuseStepNode |
Fuse step that corresponds to te::Stage::fuse. More... | |
class | FuseStep |
Managed reference to FuseStepNode. More... | |
class | PragmaStepNode |
Pragma step that corresponds to te::Stage::pragma. More... | |
class | PragmaStep |
Managed reference to PragmaStepNode. More... | |
class | ReorderStepNode |
Reorder step that corresponds to te::Stage::reorder. More... | |
class | ReorderStep |
Managed reference to ReorderStepNode. More... | |
class | SplitStepNode |
Split step that corresponds to te::Stage::split with additional support of multiple-level of factors. More... | |
class | SplitStep |
Managed reference to SplitStepNode. More... | |
class | FollowSplitStepNode |
Similar to SplitStepNode, but uses split factors from another step (i.e. Follow another split step) More... | |
class | FollowSplitStep |
Managed reference to FollowSplitStepNode. More... | |
class | FollowFusedSplitStepNode |
Similar to FollowSplitStep, but uses split factors from multiple steps. More... | |
class | FollowFusedSplitStep |
Managed reference to FollowFusedSplitStepNode. More... | |
class | StorageAlignStepNode |
Storage align step that corresponds to te::Stage::storage_align. More... | |
class | StorageAlignStep |
Managed reference to StorageAlignStepNode. More... | |
class | ComputeAtStepNode |
Compute at step that corresponds to te::Stage::compute_at. More... | |
class | ComputeAtStep |
Managed reference to ComputeAtStepNode. More... | |
class | ComputeInlineStepNode |
Compute inline step that corresponds to te::Stage::compute_inline. More... | |
class | ComputeInlineStep |
Managed reference to ComputeInlineStepNode. More... | |
class | ComputeRootStepNode |
Compute root step that corresponds to te::Stage::compute_root. More... | |
class | ComputeRootStep |
Managed reference to ComputeRootStepNode. More... | |
class | CacheReadStepNode |
Cache read step that corresponds to te::Schedule::cache_read. More... | |
class | CacheReadStep |
Managed reference to CacheReadStepNode. More... | |
class | CacheWriteStepNode |
Cache write step that corresponds to te::Schedule::cache_write. More... | |
class | CacheWriteStep |
Managed reference to CacheWriteStepNode. More... | |
class | RfactorStepNode |
Reduction factor step that corresponds to te::Schedule::rfactor. More... | |
class | RfactorStep |
Managed reference to RfactorStepNode. More... | |
Typedefs | |
using | StageKey = int |
Use stage_id to represent a stage. More... | |
using | IterKey = std::pair< int, int > |
Use stage_id and iter_id to represent a iterator. More... | |
typedef Map< tvm::te::Stage, Array< tir::IterVar >, ObjectHash, ObjectEqual > | StageToAxesMap |
Enumerations | |
enum class | LayoutRewriteOption : int { NoRewrite = 0 , InsertTransformStage = 1 , RewriteForPreTransformed = 2 } |
Options for applying layout rewrite. This is an optimization to rewrite the layout of input tensors according to the schedule we get. More... | |
enum class | StageKind : int { kPlaceholder = 0 , kCompute = 1 } |
The type of a stage. More... | |
enum class | ComputeAtKind : int { kRoot = 0 , kInlined = 1 , kIter = 2 } |
The type of compute location. More... | |
enum class | MeasureErrorNO : int { kNoError = 0 , kInstantiationError = 1 , kCompileHostError = 2 , kCompileDeviceError = 3 , kRuntimeDeviceError = 4 , kWrongAnswerError = 5 , kBuildTimeoutError = 6 , kRunTimeoutError = 7 , kUnknownError = 8 } |
The error code of one measurement. More... | |
enum class | IteratorKind : int { kSpatial = 0 , kReduction = 1 , kMixed = 2 , kSpecial = 3 } |
The type of an iterator. More... | |
enum class | IteratorAnnotation : int { kNone = 0 , kUnroll = 1 , kVectorize = 2 , kParallel = 3 , kVThread = 4 , kBlockX = 5 , kThreadX = 6 , kBlockY = 7 , kThreadY = 8 , kBlockZ = 9 , kThreadZ = 10 , kTensorize = 11 } |
The type of an iterator's annotation. More... | |
Functions | |
std::pair< te::Schedule, Array< te::Tensor > > | AutoSchedule (SearchPolicy search_policy, TuningOptions tuning_options) |
Run schedule search for a given compute declaration. More... | |
Array< PrimExpr > | GetShapeFromRewrittenLayout (String rewritten_layout, Array< String > axis_names) |
Get the orginal shape from a rewritten layout string. More... | |
void | GetPerStoreFeature (const PrimFunc &func, int cache_line_size, int max_n_bufs, std::vector< float > *ret, bool log_scale=true) |
Get per-store features from a TIR PrimFunc. More... | |
void | GetPerStoreFeatureName (int max_n_bufs, std::vector< std::string > *ret) |
void | GetPerStoreFeaturesFromStates (const Array< State > &states, const SearchTask &task, int skip_first_n_feature_extraction, int max_n_bufs, std::vector< std::vector< float >> *features) |
Get per-store feature from states of the same task. More... | |
void | GetPerStoreFeaturesFromStates (const Array< State > &states, const std::vector< SearchTask > &tasks, int skip_first_n_feature_extraction, int max_n_bufs, std::vector< std::vector< float >> *features) |
Get per-store feature from states of different tasks. More... | |
void | GetPerStoreFeaturesFromFile (const std::string &filename, int max_lines, int max_n_bufs, std::vector< std::vector< float >> *features, std::vector< float > *normalized_throughputs, std::vector< int > *task_ids) |
Get per-store features from a log file. More... | |
void | GetPerStoreFeaturesFromMeasurePairs (const Array< MeasureInput > &inputs, const Array< MeasureResult > &results, int skip_first_n_feature_extraction, int max_n_bufs, std::vector< std::vector< float >> *features, std::vector< float > *normalized_throughputs, std::vector< int > *task_ids) |
Get per-store features from measurement input/result pairs. More... | |
void | WriteMeasureRecords (std::ostream *os, const Array< MeasureInput > &inputs, const Array< MeasureResult > &results, const std::string log_version=AUTO_SCHEDULER_LOG_VERSION) |
Append measure records to an output stream. More... | |
void | ReadMeasureRecord (const std::string &str, MeasureInputNode *inp, MeasureResultNode *res, std::string *log_version) |
Read one measure record from a string. More... | |
void | UpdateStageToAxesMap (const te::Stage &stage, StageToAxesMap *stage_to_axes) |
Update the current stage IterVar information to StageToAxesMap. More... | |
Step | StepReadFromRecord (dmlc::JSONReader *reader) |
Read a step record from JSONReader and create the corresponding step. More... | |
void | StepApplyToState (const Step &step, State *state, const ComputeDAG &dag) |
Apply a general step to a State with runtime dynamic dispatching. More... | |
void | StepApplyToSchedule (const Step &step, Array< te::Stage > *stages, StageToAxesMap *stage_to_axes, te::Schedule *schedule, const Array< Step > &transform_steps) |
Apply a general step to tvm.schedule with runtime dynamic dispatching. More... | |
String | StepPrintAsPythonAPI (const Step &step, Array< te::Stage > *stages, StageToAxesMap *stage_to_axes, te::Schedule *schedule, const Array< Step > &transform_steps) |
Print a general step as equivalent python schedule API with runtime dynamic dispatching. More... | |
Variables | |
const std::string | AUTO_SCHEDULER_LOG_VERSION = "v0.6" |
const char * | IteratorAnnotationString [] |
using tvm::auto_scheduler::IterKey = typedef std::pair<int, int> |
Use stage_id and iter_id to represent a iterator.
using tvm::auto_scheduler::StageKey = typedef int |
Use stage_id to represent a stage.
typedef Map<tvm::te::Stage, Array<tir::IterVar>, ObjectHash, ObjectEqual> tvm::auto_scheduler::StageToAxesMap |
|
strong |
|
strong |
The type of an iterator's annotation.
|
strong |
|
strong |
Options for applying layout rewrite. This is an optimization to rewrite the layout of input tensors according to the schedule we get.
|
strong |
The error code of one measurement.
|
strong |
std::pair<te::Schedule, Array<te::Tensor> > tvm::auto_scheduler::AutoSchedule | ( | SearchPolicy | search_policy, |
TuningOptions | tuning_options | ||
) |
Run schedule search for a given compute declaration.
search_policy | The search policy. |
tuning_options | Tuning and measurement options. |
te::schedule
and an Array of te::Tensor
to be used in tvm.lower
or tvm.build
. void tvm::auto_scheduler::GetPerStoreFeature | ( | const PrimFunc & | func, |
int | cache_line_size, | ||
int | max_n_bufs, | ||
std::vector< float > * | ret, | ||
bool | log_scale = true |
||
) |
Get per-store features from a TIR PrimFunc.
func | The input lowered TIR PrimFunc |
cache_line_size | The size of cache line in bytes |
max_n_bufs | The maximum number of extracted buffers for one statement |
ret | The returned feature vector |
log_scale | Should the outputs be scaled by log2(1+x). |
void tvm::auto_scheduler::GetPerStoreFeatureName | ( | int | max_n_bufs, |
std::vector< std::string > * | ret | ||
) |
void tvm::auto_scheduler::GetPerStoreFeaturesFromFile | ( | const std::string & | filename, |
int | max_lines, | ||
int | max_n_bufs, | ||
std::vector< std::vector< float >> * | features, | ||
std::vector< float > * | normalized_throughputs, | ||
std::vector< int > * | task_ids | ||
) |
Get per-store features from a log file.
filename | The name of log file |
max_lines | Only read the first n lines of the file |
max_n_bufs | The maximum number of extracted buffers for one statement |
features | The returned feature vector. The innermost vector contains the feature vectors for all BufferStoreNode statements |
normalized_throughputs | The normalized throughputs for all states |
task_ids | The task ids for all states |
void tvm::auto_scheduler::GetPerStoreFeaturesFromMeasurePairs | ( | const Array< MeasureInput > & | inputs, |
const Array< MeasureResult > & | results, | ||
int | skip_first_n_feature_extraction, | ||
int | max_n_bufs, | ||
std::vector< std::vector< float >> * | features, | ||
std::vector< float > * | normalized_throughputs, | ||
std::vector< int > * | task_ids | ||
) |
Get per-store features from measurement input/result pairs.
inputs | The measurement inputs |
results | The measurement results |
skip_first_n_feature_extraction | Skip feature extraction for the first n measurement pairs |
max_n_bufs | The maximum number of extracted buffers for one statement |
features | The returned feature vector. The innermost vector contains the feature vectors for all BufferStoreNode statements |
normalized_throughputs | The normalized throughputs for all states |
task_ids | The task ids for all states |
void tvm::auto_scheduler::GetPerStoreFeaturesFromStates | ( | const Array< State > & | states, |
const SearchTask & | task, | ||
int | skip_first_n_feature_extraction, | ||
int | max_n_bufs, | ||
std::vector< std::vector< float >> * | features | ||
) |
Get per-store feature from states of the same task.
states | The input states |
task | The same search task for all states |
skip_first_n_feature_extraction | Skip feature extraction for the first n states |
max_n_bufs | The maximum number of extracted buffers for one statement |
features | The returned feature vector. The innermost vector contains the feature vectors for all BufferStoreNode statements |
void tvm::auto_scheduler::GetPerStoreFeaturesFromStates | ( | const Array< State > & | states, |
const std::vector< SearchTask > & | tasks, | ||
int | skip_first_n_feature_extraction, | ||
int | max_n_bufs, | ||
std::vector< std::vector< float >> * | features | ||
) |
Get per-store feature from states of different tasks.
states | The input states |
tasks | The search tasks corresponding to the input states |
skip_first_n_feature_extraction | Skip feature extraction for the first n states |
max_n_bufs | The maximum number of extracted buffers for one statement |
features | The returned feature vector. The innermost vector contains the feature vectors for all BufferStoreNode statements |
Array<PrimExpr> tvm::auto_scheduler::GetShapeFromRewrittenLayout | ( | String | rewritten_layout, |
Array< String > | axis_names | ||
) |
Get the orginal shape from a rewritten layout string.
rewritten_layout | The layout after auto-scheduler's layout rewrite. |
axis_names | Specifiy the names of axes. |
void tvm::auto_scheduler::ReadMeasureRecord | ( | const std::string & | str, |
MeasureInputNode * | inp, | ||
MeasureResultNode * | res, | ||
std::string * | log_version | ||
) |
Read one measure record from a string.
str | The record string to be parsed. |
inp | A pointer to a MeasureInputNode used to store the return value. |
res | A pointer to a MeasureResultNode used to store the return value. |
log_version | A pointer to a string used to store the log version. |
void tvm::auto_scheduler::StepApplyToSchedule | ( | const Step & | step, |
Array< te::Stage > * | stages, | ||
StageToAxesMap * | stage_to_axes, | ||
te::Schedule * | schedule, | ||
const Array< Step > & | transform_steps | ||
) |
Apply a general step to tvm.schedule with runtime dynamic dispatching.
step | The step to be applied to tvm.schedule. |
stages | The list of current stages |
stage_to_axes | A map that maps stage ot all its iterators. |
schedule | A mutable point to the current schedule |
transform_steps | An array of all history transform steps. |
void tvm::auto_scheduler::StepApplyToState | ( | const Step & | step, |
State * | state, | ||
const ComputeDAG & | dag | ||
) |
Apply a general step to a State with runtime dynamic dispatching.
step | The step to be applied to State. |
state | A mutable pointer to state, which will be updated. |
dag | The original ComputeDAG of this state. |
String tvm::auto_scheduler::StepPrintAsPythonAPI | ( | const Step & | step, |
Array< te::Stage > * | stages, | ||
StageToAxesMap * | stage_to_axes, | ||
te::Schedule * | schedule, | ||
const Array< Step > & | transform_steps | ||
) |
Print a general step as equivalent python schedule API with runtime dynamic dispatching.
step | The step to be printed as python API. |
stages | The list of current stages |
stage_to_axes | A map that maps stage ot all its iterators. |
schedule | A mutable point to the current schedule |
transform_steps | An array of all history transform steps. |
Step tvm::auto_scheduler::StepReadFromRecord | ( | dmlc::JSONReader * | reader | ) |
Read a step record from JSONReader and create the corresponding step.
reader | The input JSONReader. |
void tvm::auto_scheduler::UpdateStageToAxesMap | ( | const te::Stage & | stage, |
StageToAxesMap * | stage_to_axes | ||
) |
Update the current stage IterVar information to StageToAxesMap.
stage | The stage to be updated. |
stage_to_axes | The map to be updated. |
void tvm::auto_scheduler::WriteMeasureRecords | ( | std::ostream * | os, |
const Array< MeasureInput > & | inputs, | ||
const Array< MeasureResult > & | results, | ||
const std::string | log_version = AUTO_SCHEDULER_LOG_VERSION |
||
) |
Append measure records to an output stream.
os | A pointer to a output stream. |
inputs | The MeasureInputs to be written. |
results | The MeasureResults to be written. |
log_version | The log version for the given record. |
const std::string tvm::auto_scheduler::AUTO_SCHEDULER_LOG_VERSION = "v0.6" |
|
extern |