tvm
compilation_config.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
26 #ifndef TVM_TARGET_COMPILATION_CONFIG_H_
27 #define TVM_TARGET_COMPILATION_CONFIG_H_
28 
29 #include <tvm/target/se_scope.h>
30 
31 namespace tvm {
32 
49 class CompilationConfigNode : public Object {
50  public:
62 
68 
75 
81 
84 
95 
96  void VisitAttrs(AttrVisitor* v);
97 
108  SEScope CanonicalSEScope(const SEScope& se_scope) const;
109 
110  static constexpr const char* _type_key = "CompilationConfig";
112 
113  private:
129  void EstablishDefaultSEScopes(const transform::PassContext& pass_ctx);
130 
134  static Target MakeDefaultTarget(DLDeviceType device_type);
135 
139  Target FindPrimitiveTargetOrFail(DLDeviceType device_type) const;
140 
144  mutable SEScopeCache se_scope_cache_;
145 
146  friend class CompilationConfig;
147 };
148 
154 class CompilationConfig : public ObjectRef {
155  public:
162  TVM_DLL CompilationConfig(const transform::PassContext& pass_ctx, TargetMap legacy_target_map_arg,
163  Target optional_host_target_arg);
164 
166 };
167 
168 } // namespace tvm
169 
170 #endif // TVM_TARGET_COMPILATION_CONFIG_H_
friend class CompilationConfig
Definition: compilation_config.h:146
Managed reference class to CompilationConfig.
Definition: compilation_config.h:154
constexpr const char * device_type
The device type.
Definition: stmt.h:1261
TargetMap legacy_target_map
The legacy targets map, mapping device type to Targets. Does not include any entry for the host targe...
Definition: compilation_config.h:61
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:36
static SEScope FullyUnconstrained()
Returns the unique fully unconstrained SEScope.
base class of all object containers.
Definition: object.h:165
static constexpr const char * _type_key
Definition: compilation_config.h:110
A compile time representation for a Storage or Execution Scope.
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:270
Target optional_homogeneous_target
If defined then compile and/or run in &#39;homogenous execution mode&#39;. In this mode all primitives are co...
Definition: compilation_config.h:94
Target host_target
The host target. Used for &#39;scalar&#39; data and code (such as shapes and shape functions) and residual Re...
Definition: compilation_config.h:67
PassContext that is used to configure the pass behavior.
Definition: transform.h:154
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:706
A cache of SEScopes. This can be used:
Definition: se_scope.h:333
Managed reference class to TargetNode.
Definition: target.h:132
Base class of all object reference.
Definition: object.h:504
SEScope host_se_scope
SEScope for the host.
Definition: compilation_config.h:83
#define TVM_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType)
helper macro to declare type information in a final class.
Definition: object.h:664
void VisitAttrs(AttrVisitor *v)
Managed reference class to SEScopeNode.
Definition: se_scope.h:256
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
Definition: map.h:1235
Array< Target > primitive_targets
Vector of all available targets for primitive operators. May contain a Target for the same device typ...
Definition: compilation_config.h:74
SEScope CanonicalSEScope(const SEScope &se_scope) const
Returns a SEScope agreeing with se_scope on all its constrained fields, however:
Gathers the Targets and distinguished SEScopes in canonical form needed to compile a Relay module...
Definition: compilation_config.h:49
SEScope default_primitive_se_scope
SEScope for primitive operators which are not otherwise constrained to a particular device...
Definition: compilation_config.h:80