tvm
|
Managed reference to ComputeDAGNode. More...
#include <compute_dag.h>
Public Member Functions | |
ComputeDAG (Array< te::Tensor > tensors) | |
Construct a DAG from a list of output tensors. More... | |
ComputeDAG (const te::Schedule &sch) | |
Construct a DAG based on a schedule. More... | |
ComputeDAG | RewriteLayout (Array< Step > *transform_steps, LayoutRewriteOption layout_rewrite) const |
Rewrite the layout of placeholder specified by attr layout_free_placeholders according to the loop nest derived with transform_steps . More... | |
std::pair< te::Schedule, Array< te::Tensor > > | ApplySteps (const Array< Step > &transform_steps, Array< te::Stage > *stages=nullptr, StageToAxesMap *stage_to_axes=nullptr, LayoutRewriteOption layout_rewrite=LayoutRewriteOption::NoRewrite) const |
Apply the history transform steps to get a TVM schedule. More... | |
String | PrintStepsAsPython (const Array< Step > &transform_steps) const |
Print transform steps as equivalent python schedule API. This can be used for debugging. More... | |
String | PrintDAG (bool simple_mode=false) const |
Print the compute DAG to a string. This is also used to generate the ComputeDAG hash. More... | |
State | InferBound (const State &state) const |
Fill the correct bound information for a given state by calling ir_pass::InferBound. The states can lose complete bound information after some transform steps (e.g., compute_at). We can call this function to infer and fill all the bound information. This function calls TVM InferBound pass internally to get the bound. The returned state of this function is guaranteed to have complete bound information. More... | |
Array< State > | InferBound (const Array< State > &states) const |
Fill the correct bound information for the given states by calling ir_pass::InferBound. The states can lose complete bound information after some transform steps (e.g., compute_at). We can call this function to infer and fill all the bound information. This function calls TVM InferBound pass internally to get the bound. The returned state of this function is guaranteed to have complete bound information. More... | |
ComputeDAG | ReplayAndGetDAG (const Array< Step > &steps) const |
Since some steps may change the ComputeDAG (e.g. CacheRead/CacheWrite), the initial ComputeDAG may not be up-to-date. This function replays the given transform steps from the initial state and returns an up-to-date ComputeDAG. More... | |
TVM_DEFINE_OBJECT_REF_METHODS (ComputeDAG, ObjectRef, ComputeDAGNode) | |
TVM_DEFINE_OBJECT_REF_COW_METHOD (ComputeDAGNode) | |
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 Object * | get () const |
const Object * | operator-> () const |
bool | unique () const |
int | use_count () const |
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>> | |
const ObjectType * | as () const |
Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>> | |
Optional< ObjectRefType > | as () const |
Try to downcast the ObjectRef to a Optional<T> of the requested type. More... | |
Static Public Attributes | |
static constexpr const char * | layout_free_placeholders_key = "layout_free_placeholders" |
Static Public Attributes inherited from tvm::runtime::ObjectRef | |
static constexpr bool | _type_is_nullable = true |
Additional Inherited Members | |
Public Types inherited from tvm::runtime::ObjectRef | |
using | ContainerType = Object |
type indicate the container type. More... | |
Protected Member Functions inherited from tvm::runtime::ObjectRef | |
Object * | get_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< Object > | data_ |
Internal pointer that backs the reference. More... | |
Managed reference to ComputeDAGNode.
|
explicit |
Construct a DAG from a list of output tensors.
tensors | te::Tensor s for a compute declaration. |
|
explicit |
Construct a DAG based on a schedule.
sch | te::Schedule s for a compute declaration. |
std::pair<te::Schedule, Array<te::Tensor> > tvm::auto_scheduler::ComputeDAG::ApplySteps | ( | const Array< Step > & | transform_steps, |
Array< te::Stage > * | stages = nullptr , |
||
StageToAxesMap * | stage_to_axes = nullptr , |
||
LayoutRewriteOption | layout_rewrite = LayoutRewriteOption::NoRewrite |
||
) | const |
Apply the history transform steps to get a TVM schedule.
transform_steps | Transform steps of a state. |
stages | The list of stages after applying the steps. Pass a valid pointer if this information needs to be used outside this function. |
stage_to_axes | The map that stores all axes for one stage. Pass a valid pointer if this information needs to be used outside this function. |
layout_rewrite | Rewrite the layout of placeholders specified by attr layout_free_placeholders . |
Fill the correct bound information for the given states by calling ir_pass::InferBound. The states can lose complete bound information after some transform steps (e.g., compute_at). We can call this function to infer and fill all the bound information. This function calls TVM InferBound pass internally to get the bound. The returned state of this function is guaranteed to have complete bound information.
states | The input states. |
Fill the correct bound information for a given state by calling ir_pass::InferBound. The states can lose complete bound information after some transform steps (e.g., compute_at). We can call this function to infer and fill all the bound information. This function calls TVM InferBound pass internally to get the bound. The returned state of this function is guaranteed to have complete bound information.
state | The input state. |
String tvm::auto_scheduler::ComputeDAG::PrintDAG | ( | bool | simple_mode = false | ) | const |
Print the compute DAG to a string. This is also used to generate the ComputeDAG hash.
simple_mode | Simple mode will only include the op names and brief compute. |
String tvm::auto_scheduler::ComputeDAG::PrintStepsAsPython | ( | const Array< Step > & | transform_steps | ) | const |
Print transform steps as equivalent python schedule API. This can be used for debugging.
transform_steps | Transform steps of a state. |
ComputeDAG tvm::auto_scheduler::ComputeDAG::ReplayAndGetDAG | ( | const Array< Step > & | steps | ) | const |
Since some steps may change the ComputeDAG (e.g. CacheRead/CacheWrite), the initial ComputeDAG may not be up-to-date. This function replays the given transform steps from the initial state and returns an up-to-date ComputeDAG.
steps | The steps to be replayed. Usually we'll filter out the unused steps to speed up the replay process, since we only intend to get a ComputeDAG with the up-to-date op stage structure. |
ComputeDAG tvm::auto_scheduler::ComputeDAG::RewriteLayout | ( | Array< Step > * | transform_steps, |
LayoutRewriteOption | layout_rewrite | ||
) | const |
Rewrite the layout of placeholder specified by attr layout_free_placeholders
according to the loop nest derived with transform_steps
.
transform_steps | Transform steps of a state. |
layout_rewrite | Different options in layout rewrite. |
tvm::auto_scheduler::ComputeDAG::TVM_DEFINE_OBJECT_REF_COW_METHOD | ( | ComputeDAGNode | ) |
tvm::auto_scheduler::ComputeDAG::TVM_DEFINE_OBJECT_REF_METHODS | ( | ComputeDAG | , |
ObjectRef | , | ||
ComputeDAGNode | |||
) |
|
staticconstexpr |