tvm
Loading...
Searching...
No Matches
analysis.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
24#ifndef TVM_TIR_ANALYSIS_H_
25#define TVM_TIR_ANALYSIS_H_
26
27#include <tvm/ir/module.h>
28#include <tvm/ir/prim/expr.h>
29#include <tvm/ir/transform.h>
30#include <tvm/target/target.h>
31#include <tvm/tirx/function.h>
33#include <tvm/tirx/stmt.h>
34
35#include <string>
36
37namespace tvm {
38
39namespace tirx {
40
52
58
64TVM_TIRX_DLL size_t CalculateConstantBytes(const Function& func, int64_t constant_byte_alignment);
65
72TVM_TIRX_DLL size_t CalculateWorkspaceBytes(const Function& func, int64_t workspace_byte_alignment);
73
93TVM_TIRX_DLL bool VerifyWellFormed(const Function& func, bool assert_mode = true);
94
107TVM_TIRX_DLL bool VerifyWellFormed(const IRModule& mod, bool assert_mode = true);
108
116const FunctionNode* FindEntryFunc(const IRModule& mod, GlobalVar* result_g_var);
117
118// Pass variants of verification analysis
119// directly throws RuntimeError when verification fails.
120namespace transform {
121
124
132
133} // namespace transform
134} // namespace tirx
135} // namespace tvm
136#endif // TVM_TIR_ANALYSIS_H_
Managed reference to GlobalVarNode.
Definition expr.h:853
Managed reference class to IRModuleNode.
Definition module.h:255
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:447
Primitive functions that contains TIR statements.
Definition function.h:49
Managed reference to FunctionNode.
Definition function.h:105
PassContext that is used to configure the pass behavior.
Definition transform.h:62
Definition transform.h:298
TIR expressions.
Utilities for IR transformations.
IRModule that holds the functions and type definitions.
TVM_TIRX_DLL Pass VerifyMemory()
Pass variant of VerifyMemory.
TVM_TIRX_DLL size_t CalculateConstantBytes(const Function &func, int64_t constant_byte_alignment)
Calculate the constants size in bytes needed by the TIR allocates inside the TIR Function.
const FunctionNode * FindEntryFunc(const IRModule &mod, GlobalVar *result_g_var)
Find the entry function of the given IRModule, i.e, functions marked by tirx::attr::kIsEntryFunc,...
TVM_TIRX_DLL bool VerifyMemory(const Function &func)
Verify if memory accesses are legal for a specific target device type.
TVM_TIRX_DLL size_t CalculateExprComplexity(const PrimExpr &expr)
Calculate the expression complexity based on number of symbols it contains.
TVM_TIRX_DLL bool VerifyWellFormed(const Function &func, bool assert_mode=true)
Verify if the given TIR is well-formed. The verification includes:
TVM_TIRX_DLL size_t CalculateWorkspaceBytes(const Function &func, int64_t workspace_byte_alignment)
Calculate the workspace size in bytes needed by the TIR allocates inside the TIR Function.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
#define TVM_TIRX_DLL
Definition base.h:83
Compilation target object.
TIR Function.
Attribute types in the Op registry for TIR ops.
TIRx statements and shared statement entry header.