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_TIRX_ANALYSIS_H_
25#define TVM_TIRX_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>
32#include <tvm/tirx/op/attr.h>
33#include <tvm/tirx/stmt.h>
34
35#include <string>
36
37namespace tvm {
38
39namespace tirx {
40
49TVM_TIRX_DLL ffi::Array<PrimExpr> DetectLinearEquation(const PrimExpr& e,
50 const ffi::Array<PrimVar>& vars);
51
60TVM_TIRX_DLL ffi::Array<ffi::Optional<PrimExpr>> DetectClipBound(const PrimExpr& e,
61 const ffi::Array<PrimVar>& vars);
62
74
80
87TVM_TIRX_DLL bool CheckWellFormed(const Function& func, bool assert_mode = true);
88
95TVM_TIRX_DLL bool CheckWellFormed(const IRModule& mod, bool assert_mode = true);
96
104TVM_TIRX_DLL const FunctionObj* FindEntryFunc(const IRModule& mod, GlobalVar* result_g_var);
105
106// Pass variants of verification analysis
107// directly throws RuntimeError when verification fails.
108namespace transform {
109
112
120
121} // namespace transform
122} // namespace tirx
123} // namespace tvm
124#endif // TVM_TIRX_ANALYSIS_H_
TIR expressions.
Utilities for IR transformations.
#define TVM_TIRX_DLL
Definition base.h:55
TIR Function.
TIRx statements and shared statement entry header.
Managed reference to GlobalVarObj.
Definition expr.h:709
Managed reference class to IRModuleObj.
Definition module.h:292
Typed reference/view over any Expr whose ExprObj::ty is PrimType.
Definition expr.h:187
Primitive functions that contains TIR statements.
Definition function.h:50
Managed reference to FunctionObj.
Definition function.h:107
PassContext that is used to configure the pass behavior.
Definition transform.h:64
Definition transform.h:307
IRModule that holds the functions and type definitions.
TVM_TIRX_DLL Pass VerifyMemory()
Pass variant of VerifyMemory.
TVM_TIRX_DLL ffi::Array< PrimExpr > DetectLinearEquation(const PrimExpr &e, const ffi::Array< PrimVar > &vars)
Detect if e can be rewritten as e = sum_{i=0}^{n-1} var[i] * coeff[i] + coeff[n] Where coeff[i] and b...
TVM_TIRX_DLL ffi::Array< ffi::Optional< PrimExpr > > DetectClipBound(const PrimExpr &e, const ffi::Array< PrimVar > &vars)
Detect if expression corresponds to clip bound of the vars.
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 CheckWellFormed(const Function &func, bool assert_mode=true)
Check whether a TIRx function is well formed.
TVM_TIRX_DLL const FunctionObj * FindEntryFunc(const IRModule &mod, GlobalVar *result_g_var)
Find the entry function of the given IRModule, i.e, functions marked by tirx::attr::kIsEntryFunc....
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analysis.h:41
Compilation target object.
Attribute keys and callback contracts for TIRx operators.