|
Halide 21.0.0
Halide compiler and libraries
|
#include <JITModule.h>
Classes | |
| struct | Symbol |
Public Types | |
| typedef int(* | argv_wrapper) (const void *const *args) |
| A slightly more type-safe wrapper around the raw halide module. | |
Public Member Functions | |
| JITModule () | |
| JITModule (const Module &m, const LoweredFunc &fn, const std::vector< JITModule > &dependencies=std::vector< JITModule >()) | |
| const std::map< std::string, Symbol > & | exports () const |
| The exports map of a JITModule contains all symbols which are available to other JITModules which depend on this one. | |
| void * | main_function () const |
| A pointer to the raw halide function. | |
| Symbol | entrypoint_symbol () const |
| Returns the Symbol structure for the routine documented in main_function. | |
| Symbol | argv_entrypoint_symbol () const |
| Returns the Symbol structure for the argv wrapper routine corresponding to the entrypoint. | |
| argv_wrapper | argv_function () const |
| void | add_dependency (JITModule &dep) |
| Add another JITModule to the dependency chain. | |
| void | add_symbol_for_export (const std::string &name, const Symbol &extern_symbol) |
| Registers a single Symbol as available to modules which depend on this one. | |
| void | add_extern_for_export (const std::string &name, const ExternCFunction &extern_c_function) |
| Registers a single function as available to modules which depend on this one. | |
| Symbol | find_symbol_by_name (const std::string &) const |
| Look up a symbol by name in this module or its dependencies. | |
| void | compile_module (std::unique_ptr< llvm::Module > mod, const std::string &function_name, const Target &target, const std::vector< JITModule > &dependencies=std::vector< JITModule >(), const std::vector< std::string > &requested_exports=std::vector< std::string >()) |
| Take an llvm module and compile it. | |
| void | memoization_cache_set_size (int64_t size) const |
| See JITSharedRuntime::memoization_cache_set_size. | |
| void | memoization_cache_evict (uint64_t eviction_key) const |
| See JITSharedRuntime::memoization_cache_evict. | |
| void | reuse_device_allocations (bool) const |
| See JITSharedRuntime::reuse_device_allocations. | |
| int | get_num_threads () const |
| See JITSharedRuntime::get_num_threads. | |
| int | set_num_threads (int) const |
| See JITSharedRuntime::set_num_threads. | |
| bool | compiled () const |
| Return true if compile_module has been called on this module. | |
Static Public Member Functions | |
| static JITModule | make_trampolines_module (const Target &target, const std::map< std::string, JITExtern > &externs, const std::string &suffix, const std::vector< JITModule > &deps) |
| Take a list of JITExterns and generate trampoline functions which can be called dynamically via a function pointer that takes an array of void *'s for each argument and the return value. | |
Public Attributes | |
| IntrusivePtr< JITModuleContents > | jit_module |
Definition at line 146 of file JITModule.h.
| typedef int(* Halide::Internal::JITModule::argv_wrapper) (const void *const *args) |
A slightly more type-safe wrapper around the raw halide module.
Takes it arguments as an array of pointers that correspond to the arguments to main_function . This will be nullptr for a JITModule which has not yet been compiled or one that is not a Halide Func compilation at all.
Definition at line 211 of file JITModule.h.
| Halide::Internal::JITModule::JITModule | ( | ) |
Referenced by add_dependency(), and make_trampolines_module().
| Halide::Internal::JITModule::JITModule | ( | const Module & | m, |
| const LoweredFunc & | fn, | ||
| const std::vector< JITModule > & | dependencies = std::vector< JITModule >() ) |
|
static |
Take a list of JITExterns and generate trampoline functions which can be called dynamically via a function pointer that takes an array of void *'s for each argument and the return value.
References JITModule().
| const std::map< std::string, Symbol > & Halide::Internal::JITModule::exports | ( | ) | const |
The exports map of a JITModule contains all symbols which are available to other JITModules which depend on this one.
For runtime modules, this is all of the symbols exported from the runtime. For a JITted Func, it generally only contains the main result Func of the compilation, which takes its name directly from the Func declaration. One can also make a module which contains no code itself but is just an exports maps providing arbitrary pointers to functions or global variables to JITted code.
| void * Halide::Internal::JITModule::main_function | ( | ) | const |
A pointer to the raw halide function.
Its true type depends on the Argument vector passed to CodeGen_LLVM::compile. Image parameters become (halide_buffer_t *), and scalar parameters become pointers to the appropriate values. The final argument is a pointer to the halide_buffer_t defining the output. This will be nullptr for a JITModule which has not yet been compiled or one that is not a Halide Func compilation at all.
| Symbol Halide::Internal::JITModule::entrypoint_symbol | ( | ) | const |
| Symbol Halide::Internal::JITModule::argv_entrypoint_symbol | ( | ) | const |
Returns the Symbol structure for the argv wrapper routine corresponding to the entrypoint.
The argv wrapper is callable via an array of void * pointers to the arguments for the call. Returning a Symbol allows access to the LLVM type as well as the address. The address and type will be nullptr if the module has not been compiled.
| argv_wrapper Halide::Internal::JITModule::argv_function | ( | ) | const |
| void Halide::Internal::JITModule::add_dependency | ( | JITModule & | dep | ) |
Add another JITModule to the dependency chain.
Dependencies are searched to resolve symbols not found in the current compilation unit while JITting.
References JITModule().
| void Halide::Internal::JITModule::add_symbol_for_export | ( | const std::string & | name, |
| const Symbol & | extern_symbol ) |
| void Halide::Internal::JITModule::add_extern_for_export | ( | const std::string & | name, |
| const ExternCFunction & | extern_c_function ) |
Registers a single function as available to modules which depend on this one.
This routine converts the ExternSignature info into an LLVM type, which allows type safe linkage of external routines.
| Symbol Halide::Internal::JITModule::find_symbol_by_name | ( | const std::string & | ) | const |
Look up a symbol by name in this module or its dependencies.
| void Halide::Internal::JITModule::compile_module | ( | std::unique_ptr< llvm::Module > | mod, |
| const std::string & | function_name, | ||
| const Target & | target, | ||
| const std::vector< JITModule > & | dependencies = std::vector< JITModule >(), | ||
| const std::vector< std::string > & | requested_exports = std::vector< std::string >() ) |
Take an llvm module and compile it.
The requested exports will be available via the exports method.
| void Halide::Internal::JITModule::memoization_cache_set_size | ( | int64_t | size | ) | const |
| void Halide::Internal::JITModule::memoization_cache_evict | ( | uint64_t | eviction_key | ) | const |
| void Halide::Internal::JITModule::reuse_device_allocations | ( | bool | ) | const |
| int Halide::Internal::JITModule::get_num_threads | ( | ) | const |
| int Halide::Internal::JITModule::set_num_threads | ( | int | ) | const |
| bool Halide::Internal::JITModule::compiled | ( | ) | const |
Return true if compile_module has been called on this module.
| IntrusivePtr<JITModuleContents> Halide::Internal::JITModule::jit_module |
Definition at line 147 of file JITModule.h.