tvm
Loading...
Searching...
No Matches
transform.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_TRANSFORM_H_
25#define TVM_TIR_TRANSFORM_H_
26
27#include <tvm/ir/function.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
33#include <string>
34#include <vector>
35
36namespace tvm {
37namespace tirx {
38namespace transform {
39
48
51
52/*
53 * \brief Create a function pass that optimizes Functions.
54 *
55 * \param pass_func The packed function that contains the optimization.
56 * \param opt_level The optimization level of the function pass.
57 * \param name The name of the function pass.
58 *
59 * \return The created function pass.
60 */
61TVM_TIRX_DLL Pass CreateFunctionPass(
62 std::function<ffi::Optional<Function>(Function, IRModule, PassContext)> pass_func,
63 int opt_level, ffi::String name);
64
77TVM_TIRX_DLL Pass VectorizeLoop(bool enable_vectorize = true);
78
88
96
103
109
115
122
135
138
166
186
193
197static constexpr const char* kDisableLowerTVMBuiltin = "disable_lower_builtin";
198
204
211
217
227
237
244
252TVM_TIRX_DLL Pass FP8ComputeLegalize(ffi::String promote_dtype = "float16");
253
259
266
276
283
290
298
304
309TVM_TIRX_DLL Pass Filter(ffi::TypedFunction<bool(Function)> fcond);
310
319
325
331
332} // namespace transform
333} // namespace tirx
334} // namespace tvm
335
336#endif // TVM_TIR_TRANSFORM_H_
Managed reference class to IRModuleNode.
Definition module.h:255
Managed reference class to TargetObj.
Definition target.h:136
Managed reference to FunctionNode.
Definition function.h:105
PassContextObj contains the information that a pass can rely on, such as analysis results.
Definition transform.h:563
PassContext that is used to configure the pass behavior.
Definition transform.h:62
Meta data that will be used to help optimization and analysis.
Definition transform.h:228
Managed reference class for PassInfoObj.
Definition transform.h:251
PassObj is the base type of differnt types of optimization passes. It is designed as a pure class and...
Definition transform.h:268
Definition transform.h:298
Definition transform.h:379
Function nodes.
TIR expressions.
Utilities for IR transformations.
TVM_TIRX_DLL Pass CommonSubexprElim()
Implements Common Subexpression Elimination (CSE) for TIR which introduces Bind statements for duplic...
TVM_TIRX_DLL Pass LowerThreadAllreduce()
Lower cross-thread reductions to target-specific communication.
TVM_TIRX_DLL Pass AnnotateEntryFunc()
Set a Function as the entry point if it is only function in IRModule.
TVM_TIRX_DLL Pass LowerWarpMemory()
Lower warp memory access to low-level device related function calls.
TVM_TIRX_DLL Pass LowerIntrin()
Lower the target specific function intrinsics in each of the function.
TVM_TIRX_DLL Pass SplitHostDevice()
Annotate, split, and lower host/device functions.
TVM_TIRX_DLL Pass BF16StorageLegalize()
Legalize bf16 storage types to u16.
TVM_TIRX_DLL Pass RenormalizeSplitPattern()
Renormalize the split pattern from floordiv(floormod()) to floormod(floordiv()).
TVM_TIRX_DLL Pass FP8ComputeLegalize(ffi::String promote_dtype="float16")
Legalize fp8 compute Ops. Add a cast to fp16/fp32 before Ops, then add a cast back to fp8.
TVM_TIRX_DLL Pass NarrowDataType(int target_bits)
Narrow down PrimExpr datatype in stmt to target_bits.
TVM_TIRX_DLL Pass UnrollLoop()
unroll the constant loop marked by unroll. This pass also automatically attach pragma unroll tag to l...
TVM_TIRX_DLL Pass LowerTVMBuiltin()
Lower builtin intrinsics.
TVM_TIRX_DLL Pass VectorizeLoop(bool enable_vectorize=true)
Lower vectorization loops.
TVM_TIRX_DLL Pass StorageRewrite()
Rewrite storage allocation pattern. Moves the allocation to outer most possible scope....
TVM_TIRX_DLL Pass RemoveNoOp()
Remove No Op from the Stmt.
TVM_TIRX_DLL Pass LowerTIRx()
Lower the TIR to a lower level IR for the given target.
TVM_TIRX_DLL Pass PointerValueTypeRewrite()
Rewrite the pointer content type of arguments, as well as Alloc internal to the function to use the m...
TVM_TIRX_DLL Pass BindTarget(Target target)
Annotate a Function with a given target.
TVM_TIRX_DLL Pass TileDispatch()
Lower TIRx op calls using registered op dispatchers for the given target.
TVM_TIRX_DLL Pass StmtSimplify()
Run statement-level arithmetic simplifications on the TIR Function.
TVM_TIRX_DLL Pass Filter(ffi::TypedFunction< bool(Function)> fcond)
Filter Functions with a given condition.
TVM_TIRX_DLL Pass SkipAssert()
skip assert stmt.
TVM_TIRX_DLL Pass ConvertSSA()
Convert an IRModule to be SSA form.
TVM_TIRX_DLL Pass ForceNarrowIndexToInt32()
Force to narrow down indexing expressions and integer tensors to int32 dtype.
TVM_TIRX_DLL Pass DecorateDeviceScope()
Wrap a function body in a device scope region.
TVM_TIRX_DLL Pass FlattenTensor()
Flatten the multi-dimensional TensorLoad and TensorStore to single dimensional TensorLoad/TensorStore...
TVM_TIRX_DLL Pass FP8StorageLegalize()
Legalize fp8 storage types to u8.
TVM_TIRX_DLL Pass LowerTIRxCleanup()
Finalize TIRx lowering by applying layout rewriters and cleanup passes.
TVM_TIRX_DLL Pass BF16ComputeLegalize()
Legalize bf16 compute Ops. Add a cast to fp32 before Ops, then add a cast back to bf16.
TVM_TIRX_DLL Pass MakePackedAPI()
Transform the high-level Function to a low-level version that can be used as an API function.
TVM_TIRX_DLL Pass HoistIf()
Hoist loop-invariant If statements outside eligible loops.
TVM_TIRX_DLL Pass CreateModulePass(std::function< IRModule(IRModule, PassContext)> pass_func, int opt_level, ffi::String name)
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.