44#define DT_OPENCL_MAX_PLATFORMS 5
45#define DT_OPENCL_MAX_PROGRAMS 256
46#define DT_OPENCL_MAX_KERNELS 512
47#define DT_OPENCL_EVENTLISTSIZE 256
48#define DT_OPENCL_EVENTNAMELENGTH 64
49#define DT_OPENCL_MAX_ERRORS 5
50#define DT_OPENCL_MAX_INCLUDES 7
51#define DT_OPENCL_VENDOR_AMD 4098
52#define DT_OPENCL_VENDOR_NVIDIA 4318
53#define DT_OPENCL_VENDOR_INTEL 0x8086u
54#define DT_OPENCL_CBUFFSIZE 1024
57#define DT_OPENCL_DEFAULT_ERROR -999
58#define DT_OPENCL_SYSMEM_ALLOCATION -998
78#define ROUNDUP(a, n) ((a) % (n) == 0 ? (a) : ((a) / (n)+1) * (n))
81#define ROUNDUPDWD(a, b) dt_opencl_dev_roundup_width(a, b)
82#define ROUNDUPDHT(a, b) dt_opencl_dev_roundup_height(a, b)
84#define DT_OPENCL_BPP_TAG_RGBA8 (1u << 30)
85#define DT_OPENCL_BPP_ENCODE_RGBA8(bpp) ((int)((unsigned int)(bpp) | DT_OPENCL_BPP_TAG_RGBA8))
86#define DT_OPENCL_BPP_IS_RGBA8(bpp) ((((unsigned int)(bpp)) & DT_OPENCL_BPP_TAG_RGBA8) != 0u)
87#define DT_OPENCL_BPP_DECODE(bpp) ((int)(((unsigned int)(bpp)) & ~DT_OPENCL_BPP_TAG_RGBA8))
89#define DT_OPENCL_DEFAULT_COMPILE_INTEL ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
90#define DT_OPENCL_DEFAULT_COMPILE_AMD ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
91#define DT_OPENCL_DEFAULT_COMPILE_NVIDIA ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
92#define DT_OPENCL_DEFAULT_COMPILE ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
93#define DT_CLDEVICE_HEAD ("cldevice_v4")
297 size_t *param_value_size);
326 const char *cachedir,
char *md5sum,
char **includemd5,
int *loaded_cached);
330 char *md5sum,
int loaded_cached);
343 unsigned long *localmemsize);
357 const size_t *local);
379 const int height,
const int rowpitch);
389 const size_t *region,
const int rowpitch,
const int blocking);
395 const int height,
const int rowpitch);
405 const size_t *region,
const int rowpitch,
const int blocking);
411 const int bpp,
const int rowpitch);
421 const int bpp,
void *host,
const int flags);
424 size_t *origin,
size_t *region,
size_t offset);
427 size_t offset,
size_t *origin,
size_t *region);
430 size_t srcoffset,
size_t dstoffset,
size_t size);
433 const size_t size,
const int blocking);
436 const size_t size,
const int blocking);
466 const float factor,
const size_t overhead);
617 unsigned long *localmemsize)
622 size_t *kernelworkgroupsize)
687 const unsigned bpp,
const float factor,
const size_t overhead)
void dt_conf_set_bool(const char *name, int val)
void reset(dt_view_t *self)
void dt_print(dt_debug_thread_t thread, const char *msg,...)
static float kernel(const float *x, const float *y)
dt_mipmap_buffer_dsc_flags flags
cl_ulong dt_opencl_get_device_available(const int devid)
int dt_opencl_get_kernel_work_group_size(const int dev, const int kernel, size_t *kernelworkgroupsize)
cl_event * dt_opencl_events_get_slot(const int devid, const char *tag)
int dt_opencl_local_buffer_opt(const int devid, const int kernel, dt_opencl_local_buffer_t *factors)
void dt_opencl_unlock_device(const int dev)
int dt_opencl_enqueue_kernel_2d(const int dev, const int kernel, const size_t *sizes)
void * dt_opencl_alloc_device_buffer(const int devid, const size_t size)
int dt_opencl_read_host_from_device_rowpitch(const int devid, void *host, void *device, const int width, const int height, const int rowpitch)
void * dt_opencl_alloc_device_use_host_pointer(const int devid, const int width, const int height, const int bpp, void *host, const int flags)
size_t dt_opencl_get_mem_object_size(cl_mem mem)
gboolean dt_opencl_is_pinned_memory(cl_mem mem)
void dt_opencl_cleanup_device(dt_opencl_t *cl, int i)
int dt_opencl_enqueue_copy_buffer_to_image(const int devid, cl_mem src_buffer, cl_mem dst_image, size_t offset, size_t *origin, size_t *region)
void dt_opencl_init(dt_opencl_t *cl, const gboolean exclude_opencl, const gboolean print_statistics)
void dt_opencl_events_reset(const int devid)
cl_int dt_opencl_events_flush(const int devid, const int reset)
int dt_opencl_finish(const int devid)
int dt_opencl_copy_device_to_host(const int devid, void *host, void *device, const int width, const int height, const int bpp)
int dt_opencl_lock_device(const int pipetype)
gboolean dt_opencl_read_device_config(const int devid)
void dt_opencl_check_tuning(const int devid)
void * dt_opencl_alloc_device(const int devid, const int width, const int height, const int bpp)
int dt_opencl_is_inited(void)
void * dt_opencl_copy_host_to_device_constant(const int devid, const size_t size, void *host)
@ DT_OPENCL_PINNING_DISABLED
int dt_opencl_dev_roundup_height(int size, const int devid)
void * dt_opencl_copy_host_to_device_rowpitch(const int devid, void *host, const int width, const int height, const int bpp, const int rowpitch)
int dt_opencl_write_host_to_device_rowpitch(const int devid, void *host, void *device, const int width, const int height, const int rowpitch)
int dt_opencl_dev_roundup_width(int size, const int devid)
void dt_opencl_write_device_config(const int devid)
int dt_opencl_get_mem_context_id(cl_mem mem)
int dt_opencl_create_kernel(const int program, const char *name)
int dt_opencl_write_host_to_device_non_blocking(const int devid, void *host, void *device, const int width, const int height, const int bpp)
int dt_opencl_load_program(const int dev, const int prog, const char *filename, const char *binname, const char *cachedir, char *md5sum, char **includemd5, int *loaded_cached)
void * dt_opencl_map_buffer(const int devid, cl_mem buffer, const int blocking, const int flags, size_t offset, size_t size)
int dt_opencl_get_image_height(cl_mem mem)
int dt_opencl_read_host_from_device_rowpitch_non_blocking(const int devid, void *host, void *device, const int width, const int height, const int rowpitch)
int dt_opencl_write_buffer_to_device(const int devid, void *host, void *device, const size_t offset, const size_t size, const int blocking)
int dt_opencl_micro_nap(const int devid)
int dt_opencl_enqueue_copy_image(const int devid, cl_mem src, cl_mem dst, size_t *orig_src, size_t *orig_dst, size_t *region)
int dt_opencl_set_detected_device_enabled(const int detected, const gboolean enabled)
int dt_opencl_read_buffer_from_device(const int devid, void *host, void *device, const size_t offset, const size_t size, const int blocking)
int dt_opencl_build_program(const int dev, const int prog, const char *binname, const char *cachedir, char *md5sum, int loaded_cached)
int dt_opencl_get_max_work_item_sizes(const int dev, size_t *sizes)
int dt_opencl_enqueue_barrier(const int devid)
gboolean dt_opencl_image_fits_device(const int devid, const size_t width, const size_t height, const unsigned bpp, const float factor, const size_t overhead)
int dt_opencl_unmap_mem_object(const int devid, cl_mem mem_object, void *mapped_ptr)
int dt_opencl_read_host_from_device_raw(const int devid, void *host, void *device, const size_t *origin, const size_t *region, const int rowpitch, const int blocking)
gboolean dt_opencl_detected_device_pinned_memory(const int detected)
int dt_opencl_set_detected_device_headroom(const int detected, const size_t headroom)
int dt_opencl_is_enabled(void)
void dt_opencl_md5sum(const char **files, char **md5sums)
void dt_opencl_free_kernel(const int kernel)
gboolean dt_opencl_use_pinned_memory(const int devid)
void dt_opencl_cleanup(dt_opencl_t *cl)
int dt_opencl_get_image_width(cl_mem mem)
cl_ulong dt_opencl_get_device_memalloc(const int devid)
#define DT_OPENCL_EVENTNAMELENGTH
void dt_opencl_memory_statistics(int devid, cl_mem mem, dt_opencl_memory_t action)
int dt_opencl_read_host_from_device_non_blocking(const int devid, void *host, void *device, const int width, const int height, const int bpp)
int dt_opencl_get_detected_device_count(void)
void * dt_opencl_map_image(const int devid, cl_mem buffer, const int blocking, const int flags, size_t width, size_t height, int bpp)
#define DT_OPENCL_MAX_PROGRAMS
void * dt_opencl_alloc_device_buffer_with_flags(const int devid, const size_t size, const int flags, void *host_ptr)
int dt_opencl_write_host_to_device_rowpitch_non_blocking(const int devid, void *host, void *device, const int width, const int height, const int rowpitch)
int dt_opencl_set_kernel_arg(const int dev, const int kernel, const int num, const size_t size, const void *arg)
int dt_opencl_enqueue_copy_image_to_buffer(const int devid, cl_mem src_image, cl_mem dst_buffer, size_t *origin, size_t *region, size_t offset)
int dt_opencl_update_settings(void)
void dt_opencl_events_wait_for(const int devid)
int dt_opencl_set_detected_device_pinned_memory(const int detected, const gboolean enabled)
int dt_opencl_read_host_from_device(const int devid, void *host, void *device, const int width, const int height, const int bpp)
void dt_opencl_events_profiling(const int devid, const int aggregated)
int dt_opencl_get_work_group_limits(const int dev, size_t *sizes, size_t *workgroupsize, unsigned long *localmemsize)
int dt_opencl_enqueue_kernel_2d_with_local(const int dev, const int kernel, const size_t *sizes, const size_t *local)
cl_mem_flags dt_opencl_get_mem_flags(cl_mem mem)
int dt_opencl_enqueue_copy_buffer_to_buffer(const int devid, cl_mem src_buffer, cl_mem dst_buffer, size_t srcoffset, size_t dstoffset, size_t size)
const dt_opencl_detected_device_t * dt_opencl_get_detected_device(const int detected)
void * dt_opencl_copy_host_to_device(const int devid, void *host, const int width, const int height, const int bpp)
int dt_opencl_write_host_to_device_raw(const int devid, const void *host, void *device, const size_t *origin, const size_t *region, const int rowpitch, const int blocking)
size_t dt_opencl_detected_device_headroom(const int detected)
#define DT_OPENCL_MAX_KERNELS
void dt_opencl_release_mem_object(cl_mem mem)
int dt_opencl_get_image_element_size(cl_mem mem)
gboolean dt_opencl_detected_device_enabled(const int detected)
int dt_opencl_get_device_info(dt_opencl_t *cl, cl_device_id device, cl_device_info param_name, void **param_value, size_t *param_value_size)
int dt_opencl_avoid_atomics(const int devid)
int dt_opencl_write_host_to_device(const int devid, void *host, void *device, const int width, const int height, const int bpp)
void dt_opencl_disable(void)
cl_command_queue cmd_queue
dt_opencl_eventtag_t * eventtags
struct dt_gaussian_cl_global_t * gaussian
int opencl_synchronization_timeout
int * dev_priority_preview
struct dt_bilateral_cl_global_t * bilateral
struct dt_colorspaces_cl_global_t * colorspaces
struct dt_guided_filter_cl_global_t * guided_filter
struct dt_interpolation_cl_global_t * interpolation
struct dt_local_laplacian_cl_global_t * local_laplacian
struct dt_blendop_cl_global_t * blendop
struct dt_dwt_cl_global_t * dwt
int * dev_priority_export
dt_opencl_detected_device_t * detected_devs
int * dev_priority_thumbnail
struct dt_heal_cl_global_t * heal