tvm
codegen.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_TARGET_CODEGEN_H_
25 #define TVM_TARGET_CODEGEN_H_
26 
27 #include <tvm/ir/module.h>
28 #include <tvm/runtime/module.h>
29 #include <tvm/target/target.h>
30 #include <tvm/tir/expr.h>
31 
32 #include <string>
33 
34 namespace tvm {
36 namespace codegen {
37 // use packed function from runtime.
38 using ffi::Any;
39 using ffi::Function;
40 using ffi::PackedArgs;
41 
48 ffi::Module Build(IRModule mod, Target target);
49 
56 std::string SerializeModuleToBytes(const ffi::Module& mod, bool export_dso = true);
57 
63 ffi::Module DeserializeModuleFromBytes(std::string blob);
64 
76 std::string PackImportsToC(const ffi::Module& m, bool system_lib,
77  const std::string& c_symbol_prefix = "");
78 
92 ffi::Module PackImportsToLLVM(const ffi::Module& m, bool system_lib,
93  const std::string& target_triple,
94  const std::string& c_symbol_prefix = "");
95 
96 } // namespace codegen
97 } // namespace tvm
98 #endif // TVM_TARGET_CODEGEN_H_
Managed reference class to IRModuleNode.
Definition: module.h:257
Managed reference class to TargetNode.
Definition: target.h:191
IRModule that holds the functions and type definitions.
ffi::Module PackImportsToLLVM(const ffi::Module &m, bool system_lib, const std::string &target_triple, const std::string &c_symbol_prefix="")
Pack imported device library to a LLVM module. Compile the LLVM module and link with the host library...
std::string SerializeModuleToBytes(const ffi::Module &mod, bool export_dso=true)
Serialize runtime module including its submodules.
std::string PackImportsToC(const ffi::Module &m, bool system_lib, const std::string &c_symbol_prefix="")
Pack imported device library to a C file. Compile the C file and link with the host library will allo...
ffi::Module Build(IRModule mod, Target target)
Build a module from array of lowered function.
ffi::Module DeserializeModuleFromBytes(std::string blob)
Deserialize runtime module including its submodules.
tvm::relax::Function Function
Definition: transform.h:42
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:306
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
Runtime container of the functions generated by TVM, This is used to support dynamically link,...
Compilation target object.
TIR expressions.