tvm
Functions
tvm::codegen Namespace Reference

namespace for target translation and codegen. More...

Functions

runtime::Module Build (IRModule mod, Target target)
 Build a module from array of lowered function. More...
 
std::string SerializeModuleToBytes (const runtime::Module &mod, bool export_dso=true)
 Serialize runtime module including its submodules. More...
 
runtime::Module DeserializeModuleFromBytes (std::string blob)
 Deserialize runtime module including its submodules. More...
 
std::string PackImportsToC (const runtime::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 allow the DSO loader to automatically discover and import the dependency from the shared library. More...
 
runtime::Module PackImportsToLLVM (const runtime::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 will allow the DSO loader to automatically discover and import the dependency from the shared library. More...
 

Detailed Description

namespace for target translation and codegen.

Function Documentation

◆ Build()

runtime::Module tvm::codegen::Build ( IRModule  mod,
Target  target 
)

Build a module from array of lowered function.

Parameters
modThe Module to be built
targetThe target to be built.
Returns
The result runtime::Module.

◆ DeserializeModuleFromBytes()

runtime::Module tvm::codegen::DeserializeModuleFromBytes ( std::string  blob)

Deserialize runtime module including its submodules.

Parameters
blobbyte stream, which are generated by SerializeModuleToBytes.
Returns
runtime::Module runtime module constructed from the given stream

◆ PackImportsToC()

std::string tvm::codegen::PackImportsToC ( const runtime::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 allow the DSO loader to automatically discover and import the dependency from the shared library.

Parameters
mThe host module with the imports.
system_libWhether expose as system library.
c_symbol_prefixOptional symbol prefix of the blob symbol.
Returns
cstr The C string representation of the file.

◆ PackImportsToLLVM()

runtime::Module tvm::codegen::PackImportsToLLVM ( const runtime::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 will allow the DSO loader to automatically discover and import the dependency from the shared library.

Parameters
mThe host module with the imports.
system_libWhether expose as system library.
target_tripleLLVM target triple
c_symbol_prefixOptional symbol prefix of the blob symbol.
Returns
runtime::Module The generated LLVM module.

◆ SerializeModuleToBytes()

std::string tvm::codegen::SerializeModuleToBytes ( const runtime::Module mod,
bool  export_dso = true 
)

Serialize runtime module including its submodules.

Parameters
modThe runtime module to serialize including its import tree.
export_dsoBy default, include the info of DSOExportable modules. If disabled, an error will be raised when encountering DSO modules.