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."
15typedef __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
88const char *
strstr(
const char *,
const char *);
90int strcmp(
const char *s,
const char *t);
91int strncmp(
const char *s,
const char *t,
size_t n);
93const char *
strchr(
const char *s,
int c);
94void *
memcpy(
void *s1,
const void *s2,
size_t n);
95int memcmp(
const void *s1,
const void *s2,
size_t n);
96void *
memset(
void *s,
int val,
size_t n);
99void *
fopen(
const char *,
const char *);
103size_t fwrite(
const void *,
size_t,
size_t,
void *);
106int ioctl(
int fd,
unsigned long request, ...);
107char *
strncpy(
char *dst,
const char *src,
size_t n);
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);
205 return a > b ? a : b;
210 return a < b ? a : b;
233#define _halide_stringify(x) #x
234#define _halide_expand_and_stringify(x) _halide_stringify(x)
235#define halide_abort_if_false(user_context, cond) \
238 halide_print(user_context, __FILE__ ":" _halide_expand_and_stringify(__LINE__) " halide_abort_if_false() failed: " #cond "\n"); \
246#define halide_debug_assert(user_context, cond) \
249 halide_print(user_context, __FILE__ ":" _halide_expand_and_stringify(__LINE__) " halide_debug_assert() failed: " #cond "\n"); \
254#define halide_debug_assert(user_context, cond)
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)
const char * strchr(const char *s, int c)
signed __INT64_TYPE__ int64_t
WEAK int halide_host_cpu_count()
int ioctl(int fd, unsigned long request,...)
WEAK void * halide_get_library_symbol(void *lib, const char *name)
WEAK char * halide_uint64_to_string(char *dst, char *end, uint64_t arg, int digits)
int strcmp(const char *s, const char *t)
void * halide_malloc(void *user_context, size_t x)
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_load_library(const char *name)
WEAK void halide_device_free_as_destructor(void *user_context, void *obj)
WEAK void halide_sleep_ms(void *user_context, int ms)
size_t fwrite(const void *, size_t, size_t, void *)
WEAK int halide_device_and_host_free(void *user_context, struct halide_buffer_t *buf)
WEAK char * halide_type_to_string(char *dst, char *end, const halide_type_t *arg)
WEAK void halide_release_jit_module()
WEAK void * halide_get_symbol(const char *name)
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)
__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()
char * strncpy(char *dst, const char *src, size_t n)
unsigned __INT16_TYPE__ uint16_t
WEAK char * halide_int64_to_string(char *dst, char *end, int64_t arg, int digits)
WEAK char * halide_pointer_to_string(char *dst, char *end, const void *arg)
void * memcpy(void *s1, const void *s2, size_t n)
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)
void * memset(void *s, int val, size_t n)
unsigned __INT32_TYPE__ uint32_t
WEAK char * halide_double_to_string(char *dst, char *end, double arg, int scientific)
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_error(void *user_context, const char *msg)
WEAK void halide_use_jit_module()
const char * strstr(const char *, const char *)
signed __INT8_TYPE__ int8_t
WEAK char * halide_buffer_to_string(char *dst, char *end, const halide_buffer_t *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)
char * getenv(const char *)
WEAK void halide_profiler_memory_free(void *user_context, void *pipeline_state, int func_id, uint64_t decr)
WEAK char * halide_string_to_string(char *dst, char *end, const char *arg)
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.