tvm
|
Gathers the Targets
and distinguished SEScopes
in canonical form needed to compile a Relay module. All centralizes any setup and validation logic needed to transition from configuration options conveyed implicitly (eg in PassContexts
) or explicitly (eg a a list of Targets
) to the configuration.
More...
#include <compilation_config.h>
Public Member Functions | |
void | VisitAttrs (AttrVisitor *v) |
SEScope | CanonicalSEScope (const SEScope &se_scope) const |
Returns a SEScope agreeing with se_scope on all its constrained fields, however: More... | |
![]() | |
uint32_t | type_index () const |
std::string | GetTypeKey () const |
size_t | GetTypeKeyHash () const |
template<typename TargetType > | |
bool | IsInstance () const |
bool | unique () const |
Object () | |
Object (const Object &other) | |
Object (Object &&other) | |
Object & | operator= (const Object &other) |
Object & | operator= (Object &&other) |
Public Attributes | |
TargetMap | legacy_target_map |
The legacy targets map, mapping device type to Targets . Does not include any entry for the host target. Intended to give a unique Target for every DLDeviceType , though we want to get rid of that limitation. More... | |
Target | host_target |
The host target. Used for 'scalar' data and code (such as shapes and shape functions) and residual Relay expressions and data (such as conditionals and ADTs). More... | |
Array< Target > | primitive_targets |
Vector of all available targets for primitive operators. May contain a Target for the same device type as for the host_target , however the host_target should be preferred for all host computations and data. More... | |
SEScope | default_primitive_se_scope = SEScope::FullyUnconstrained() |
SEScope for primitive operators which are not otherwise constrained to a particular device. More... | |
SEScope | host_se_scope = SEScope::FullyUnconstrained() |
SEScope for the host. More... | |
Target | optional_homogeneous_target |
If defined then compile and/or run in 'homogenous execution mode'. In this mode all primitives are compiled for this target only. More... | |
Static Public Attributes | |
static constexpr const char * | _type_key = "CompilationConfig" |
![]() | |
static constexpr const char * | _type_key = "runtime.Object" |
static constexpr bool | _type_final = false |
static constexpr uint32_t | _type_child_slots = 0 |
static constexpr bool | _type_child_slots_can_overflow = true |
static constexpr bool | _type_has_method_visit_attrs = true |
static constexpr bool | _type_has_method_sequal_reduce = false |
static constexpr bool | _type_has_method_shash_reduce = false |
static constexpr uint32_t | _type_index = TypeIndex::kDynamic |
Friends | |
class | CompilationConfig |
Additional Inherited Members | |
![]() | |
typedef void(* | FDeleter) (Object *self) |
Object deleter. More... | |
using | RefCounterType = std::atomic< int32_t > |
![]() | |
static std::string | TypeIndex2Key (uint32_t tindex) |
Get the type key of the corresponding index from runtime. More... | |
static size_t | TypeIndex2KeyHash (uint32_t tindex) |
Get the type key hash of the corresponding index from runtime. More... | |
static uint32_t | TypeKey2Index (const std::string &key) |
Get the type index of the corresponding key from runtime. More... | |
static uint32_t | _GetOrAllocRuntimeTypeIndex () |
static uint32_t | RuntimeTypeIndex () |
![]() | |
void | IncRef () |
developer function, increases reference counter. More... | |
void | DecRef () |
developer function, decrease reference counter. More... | |
![]() | |
static uint32_t | GetOrAllocRuntimeTypeIndex (const std::string &key, uint32_t static_tindex, uint32_t parent_tindex, uint32_t type_child_slots, bool type_child_slots_can_overflow) |
Get the type index using type key. More... | |
![]() | |
uint32_t | type_index_ {0} |
Type index(tag) that indicates the type of the object. More... | |
RefCounterType | ref_counter_ {0} |
The internal reference counter. More... | |
FDeleter | deleter_ = nullptr |
deleter of this object to enable customized allocation. If the deleter is nullptr, no deletion will be performed. The creator of the object must always set the deleter field properly. More... | |
Gathers the Targets
and distinguished SEScopes
in canonical form needed to compile a Relay module. All centralizes any setup and validation logic needed to transition from configuration options conveyed implicitly (eg in PassContexts
) or explicitly (eg a a list of Targets
) to the configuration.
CAUTION: This is subject to change as we rework compilation options in general. See https://github.com/apache/tvm-rfcs/blob/main/rfcs/0028-command-line-registry-composition.md. So far this class is only focussed on carrying just the configuration needed by PlanDevices, and removing target-munging code duplication and inconsistencies between the three major build flows for the VM (relay/backend/vm/compile.cc), Graph/AOT (relay/backend/build_module.cc) and Interpreter (relay/backend/interpreter.cc). Over time we expect more global compiler configuration (eg for executor and runtime config, for system memory pool configuration, etc) to migrate into this class, and instances thereof to be attached to IRModules
using a well-known attribute.
Returns a SEScope
agreeing with se_scope
on all its constrained fields, however:
SEScopes
returned by this method.We call the result the 'canonical' SEScope
. Two canonical SEScopes
are structurally equal if and only if they are pointer equal.
void tvm::CompilationConfigNode::VisitAttrs | ( | AttrVisitor * | v | ) |
|
friend |
|
static |
SEScope tvm::CompilationConfigNode::default_primitive_se_scope = SEScope::FullyUnconstrained() |
SEScope
for primitive operators which are not otherwise constrained to a particular device.
SEScope tvm::CompilationConfigNode::host_se_scope = SEScope::FullyUnconstrained() |
SEScope for the host.
Target tvm::CompilationConfigNode::host_target |
The host target. Used for 'scalar' data and code (such as shapes and shape functions) and residual Relay expressions and data (such as conditionals and ADTs).
TargetMap tvm::CompilationConfigNode::legacy_target_map |
The legacy targets map, mapping device type to Targets
. Does not include any entry for the host target. Intended to give a unique Target
for every DLDeviceType
, though we want to get rid of that limitation.
CAUTION: Since keys are Integers
they are compared by object equality not integer value.
TODO(mbs): Remove once codegen updated for new target conventions.
Target tvm::CompilationConfigNode::optional_homogeneous_target |
If defined then compile and/or run in 'homogenous execution mode'. In this mode all primitives are compiled for this target only.
This is to support legacy passes which have not been adapted to hetrogeneous execution and rely on an implicit global Target
to be in scope.
TODO(mbs): Remove once all passes are 'hetrogeneous aware'.
Vector of all available targets for primitive operators. May contain a Target
for the same device type as for the host_target
, however the host_target
should be preferred for all host computations and data.