2017-01-23 04:45:31 +03:00
|
|
|
/*!
|
|
|
|
* Copyright (c) 2016 by Contributors
|
|
|
|
* \file codegen.h
|
|
|
|
* \brief Collection of Lowlevel IR pass to codegen.
|
|
|
|
*/
|
|
|
|
#ifndef TVM_CODEGEN_H_
|
|
|
|
#define TVM_CODEGEN_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "./base.h"
|
|
|
|
#include "./expr.h"
|
2017-01-31 06:09:22 +03:00
|
|
|
#include "./lowered_func.h"
|
2017-02-24 21:32:11 +03:00
|
|
|
#include "./api_registry.h"
|
2017-01-25 10:47:07 +03:00
|
|
|
#include "./runtime/packed_func.h"
|
2017-01-24 08:41:04 +03:00
|
|
|
|
2017-01-23 04:45:31 +03:00
|
|
|
namespace tvm {
|
|
|
|
/*! \brief namespace for lowlevel IR pass and codegen */
|
|
|
|
namespace codegen {
|
2017-01-31 06:09:22 +03:00
|
|
|
// use packed function from runtime.
|
|
|
|
using runtime::PackedFunc;
|
|
|
|
using runtime::TVMArgs;
|
|
|
|
using runtime::TVMRetValue;
|
|
|
|
|
|
|
|
/*!
|
2017-02-24 21:32:11 +03:00
|
|
|
* \brief Build a module from array of lowered function.
|
|
|
|
* \param funcs The functions to be built.
|
|
|
|
* \param target The target to be built.
|
|
|
|
* \return The builded module.
|
2017-01-31 06:09:22 +03:00
|
|
|
*
|
2017-02-24 21:32:11 +03:00
|
|
|
* \note Calls global API function "_codegen_build_" + target
|
2017-01-31 06:09:22 +03:00
|
|
|
*/
|
2017-02-24 21:32:11 +03:00
|
|
|
runtime::Module Build(const Array<LoweredFunc>& funcs,
|
|
|
|
const std::string& target);
|
2017-05-09 08:19:20 +03:00
|
|
|
/*!
|
|
|
|
* \brief 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.
|
|
|
|
*
|
|
|
|
* \param m The host module with the imports.
|
2017-07-07 22:16:37 +03:00
|
|
|
* \param system_lib Whether expose as system library.
|
2017-05-09 08:19:20 +03:00
|
|
|
* \return cstr The C string representation of the file.
|
|
|
|
*/
|
2017-07-07 22:16:37 +03:00
|
|
|
std::string PackImportsToC(const runtime::Module& m, bool system_lib);
|
2017-01-23 04:45:31 +03:00
|
|
|
} // namespace codegen
|
|
|
|
} // namespace tvm
|
|
|
|
|
|
|
|
#endif // TVM_CODEGEN_H_
|