1 #ifndef HALIDE_RUNTIME_INTERNAL_H
2 #define HALIDE_RUNTIME_INTERNAL_H
5 #error "Halide runtime files must be compiled with clang in freestanding mode."
15 typedef __INT8_TYPE__
int8_t;
48 #define WEAK __attribute__((weak))
51 #define ALWAYS_INLINE inline __attribute__((always_inline))
54 #define WEAK_INLINE __attribute__((weak, always_inline))
59 #define INT64_C(c) c##L
60 #define UINT64_C(c) c##UL
66 #define INT64_C(c) c##LL
67 #define UINT64_C(c) c##ULL
72 #define STDOUT_FILENO 1
73 #define STDERR_FILENO 2
88 const char *
strstr(
const char *,
const char *);
90 int strcmp(
const char *s,
const char *t);
91 int strncmp(
const char *s,
const char *t,
size_t n);
93 const char *
strchr(
const char *s,
int c);
94 void *
memcpy(
void *s1,
const void *s2,
size_t n);
95 int memcmp(
const void *s1,
const void *s2,
size_t n);
96 void *
memset(
void *s,
int val,
size_t n);
99 void *
fopen(
const char *,
const char *);
103 size_t fwrite(
const void *,
size_t,
size_t,
void *);
106 int ioctl(
int fd,
unsigned long request, ...);
145 void *pipeline_state,
148 void *pipeline_state,
152 void *pipeline_state,
156 const char *pipeline_name,
170 int nlhs, mxArray **plhs,
int nrhs,
const mxArray **prhs);
174 void *value,
int *coords,
175 int type_code,
int type_bits,
int type_lanes,
177 int parent_id,
int value_index,
int dimensions,
178 const char *trace_tag);
204 return a > b ? a : b;
209 return a < b ? a : b;
230 #define _halide_stringify(x) #x
231 #define _halide_expand_and_stringify(x) _halide_stringify(x)
232 #define halide_assert(user_context, cond) \
235 halide_print(user_context, __FILE__ ":" _halide_expand_and_stringify(__LINE__) " Assert failed: " #cond "\n"); \
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
Expr min(const FuncRef &a, const FuncRef &b)
Explicit overloads of min and max for FuncRef.
Expr print(const std::vector< Expr > &values)
Create an Expr that prints out its value whenever it is evaluated.
Expr max(const FuncRef &a, const FuncRef &b)
unsigned __INT64_TYPE__ uint64_t
int remove(const char *pathname)
WEAK char * halide_buffer_to_string(char *dst, char *end, const halide_buffer_t *arg)
signed __INT64_TYPE__ int64_t
WEAK int halide_host_cpu_count()
int ioctl(int fd, unsigned long request,...)
int strcmp(const char *s, const char *t)
const char * strchr(const char *s, int c)
void halide_free(void *user_context, void *ptr)
WEAK int halide_device_and_host_malloc(void *user_context, struct halide_buffer_t *buf, const struct halide_device_interface_t *device_interface)
WEAK int halide_trace_helper(void *user_context, const char *func, void *value, int *coords, int type_code, int type_bits, int type_lanes, int code, int parent_id, int value_index, int dimensions, const char *trace_tag)
int strncmp(const char *s, const char *t, size_t n)
WEAK int halide_start_clock(void *user_context)
WEAK void * halide_get_symbol(const char *name)
WEAK void halide_device_free_as_destructor(void *user_context, void *obj)
WEAK char * halide_uint64_to_string(char *dst, char *end, uint64_t arg, int digits)
WEAK void halide_sleep_ms(void *user_context, int ms)
size_t fwrite(const void *, size_t, size_t, void *)
WEAK char * halide_double_to_string(char *dst, char *end, double arg, int scientific)
WEAK int halide_device_and_host_free(void *user_context, struct halide_buffer_t *buf)
WEAK void halide_release_jit_module()
signed __INT32_TYPE__ int32_t
WEAK int halide_profiler_pipeline_start(void *user_context, const char *pipeline_name, int num_funcs, const uint64_t *func_names)
unsigned __INT8_TYPE__ uint8_t
WEAK void halide_profiler_stack_peak_update(void *user_context, void *pipeline_state, uint64_t *f_values)
WEAK void halide_device_and_host_free_as_destructor(void *user_context, void *obj)
void * memset(void *s, int val, size_t n)
WEAK char * halide_string_to_string(char *dst, char *end, const char *arg)
__PTRDIFF_TYPE__ ptrdiff_t
WEAK int halide_matlab_call_pipeline(void *user_context, int(*pipeline)(void **args), const halide_filter_metadata_t *metadata, int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
WEAK_INLINE int halide_malloc_alignment()
WEAK void(*)(void *, const char *) halide_set_custom_print(void(*print)(void *, const char *))
void halide_thread_yield()
unsigned __INT16_TYPE__ uint16_t
char * getenv(const char *)
WEAK char * halide_type_to_string(char *dst, char *end, const halide_type_t *arg)
ssize_t write(int fd, const void *buf, size_t bytes)
WEAK void halide_print(void *user_context, const char *msg)
int memcmp(const void *s1, const void *s2, size_t n)
size_t strlen(const char *s)
const char * strstr(const char *, const char *)
void * halide_malloc(void *user_context, size_t x)
unsigned __INT32_TYPE__ uint32_t
WEAK void halide_profiler_memory_allocate(void *user_context, void *pipeline_state, int func_id, uint64_t incr)
WEAK int64_t halide_current_time_ns(void *user_context)
signed __INT16_TYPE__ int16_t
WEAK void * halide_get_library_symbol(void *lib, const char *name)
WEAK void halide_error(void *user_context, const char *msg)
WEAK void halide_use_jit_module()
WEAK void * halide_load_library(const char *name)
signed __INT8_TYPE__ int8_t
char * strncpy(char *dst, const char *src, size_t n)
void * memcpy(void *s1, const void *s2, size_t n)
WEAK char * halide_pointer_to_string(char *dst, char *end, const void *arg)
WEAK void(*)(void *, const char *) halide_set_error_handler(void(*handler)(void *, const char *))
void * fopen(const char *, const char *)
WEAK void halide_device_host_nop_free(void *user_context, void *obj)
WEAK char * halide_int64_to_string(char *dst, char *end, int64_t arg, int digits)
WEAK void halide_profiler_memory_free(void *user_context, void *pipeline_state, int func_id, uint64_t decr)
The raw representation of an image passed around by generated Halide code.
Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device all...
A runtime tag for a type in the halide type system.