Halide 19.0.0
Halide compiler and libraries
|
A set of custom overrides of runtime functions. More...
#include <JITModule.h>
Public Attributes | |
void(* | custom_print )(JITUserContext *, const char *) |
Set the function called to print messages from the runtime. | |
void *(* | custom_malloc )(JITUserContext *, size_t) |
A custom malloc and free for halide to use. | |
void(* | custom_free )(JITUserContext *, void *) |
int(* | custom_do_task )(JITUserContext *, int(*)(JITUserContext *, int, uint8_t *), int, uint8_t *) |
A custom task handler to be called by the parallel for loop. | |
int(* | custom_do_par_for )(JITUserContext *, int(*)(JITUserContext *, int, uint8_t *), int, int, uint8_t *) |
A custom parallel for loop launcher. | |
void(* | custom_error )(JITUserContext *, const char *) |
The error handler function that be called in the case of runtime errors during halide pipelines. | |
int32_t(* | custom_trace )(JITUserContext *, const halide_trace_event_t *) |
A custom routine to call when tracing is enabled. | |
void *(* | custom_get_symbol )(const char *name) |
A method to use for Halide to resolve symbol names dynamically in the calling process or library from within the Halide runtime. | |
void *(* | custom_load_library )(const char *name) |
A method to use for Halide to dynamically load libraries from within the runtime. | |
void *(* | custom_get_library_symbol )(void *lib, const char *name) |
A method to use for Halide to dynamically find a symbol within an opened library. | |
int32_t(* | custom_cuda_acquire_context )(JITUserContext *user_context, void **cuda_context_ptr, bool create) |
A custom method for the Halide runtime acquire a cuda context. | |
int32_t(* | custom_cuda_release_context )(JITUserContext *user_context) |
The Halide runtime calls this when it is done with a cuda context. | |
int32_t(* | custom_cuda_get_stream )(JITUserContext *user_context, void *cuda_context, void **stream_ptr) |
A custom method for the Halide runtime to acquire a cuda stream to use. | |
A set of custom overrides of runtime functions.
These only apply when JIT-compiling code. If you are doing AOT compilation, see HalideRuntime.h for instructions on how to replace runtime functions.
Definition at line 35 of file JITModule.h.
|
inline |
Set the function called to print messages from the runtime.
Definition at line 37 of file JITModule.h.
|
inline |
A custom malloc and free for halide to use.
Malloc should return 32-byte aligned chunks of memory, and it should be safe for Halide to read slightly out of bounds (up to 8 bytes before the start or beyond the end).
Definition at line 44 of file JITModule.h.
|
inline |
Definition at line 45 of file JITModule.h.
|
inline |
A custom task handler to be called by the parallel for loop.
It is useful to set this if you want to do some additional bookkeeping at the granularity of parallel tasks. The default implementation does this:
If you're trying to use a custom parallel runtime, you probably don't want to call this. See instead custom_do_par_for.
Definition at line 63 of file JITModule.h.
|
inline |
A custom parallel for loop launcher.
Useful if your app already manages a thread pool. The default implementation is equivalent to this:
However, notwithstanding the above example code, if one task fails, we may skip over other tasks, and if two tasks return different error codes, we may select one arbitrarily to return.
Definition at line 85 of file JITModule.h.
|
inline |
The error handler function that be called in the case of runtime errors during halide pipelines.
Definition at line 89 of file JITModule.h.
|
inline |
A custom routine to call when tracing is enabled.
Call this on the output Func of your pipeline. This then sets custom routines for the entire pipeline, not just calls to this Func.
Definition at line 95 of file JITModule.h.
|
inline |
A method to use for Halide to resolve symbol names dynamically in the calling process or library from within the Halide runtime.
Equivalent to dlsym with a null first argument.
Definition at line 100 of file JITModule.h.
|
inline |
A method to use for Halide to dynamically load libraries from within the runtime.
Equivalent to dlopen. Returns a handle to the opened library.
Definition at line 105 of file JITModule.h.
|
inline |
A method to use for Halide to dynamically find a symbol within an opened library.
Equivalent to dlsym. Takes a handle returned by custom_load_library as the first argument.
Definition at line 110 of file JITModule.h.
|
inline |
A custom method for the Halide runtime acquire a cuda context.
The cuda context is treated as a void * to avoid a dependence on the cuda headers. If the create argument is set to true, a context should be created if one does not already exist.
Definition at line 117 of file JITModule.h.
|
inline |
The Halide runtime calls this when it is done with a cuda context.
The default implementation does nothing.
Definition at line 121 of file JITModule.h.
|
inline |
A custom method for the Halide runtime to acquire a cuda stream to use.
The cuda context and stream are both modelled as a void *, to avoid a dependence on the cuda headers.
Definition at line 126 of file JITModule.h.