Internal::JITModule#
-
struct JITModule#
Public Types
- int(*) 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.
Public Functions
-
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.
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 *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 entrypoint_symbol() const#
Returns the Symbol structure for the routine documented in main_function.
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.
-
Symbol 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.
-
void 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.
-
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.
The Symbol structure provides both the address and the LLVM type for the function, which allows type safe linkage of external routines.
-
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.
This routine converts the ExternSignature info into an LLVM type, which allows type safe linkage of external routines.
-
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.
The requested exports will be available via the exports method.
-
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.
Public Static 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.
-
struct Symbol#