Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
opencl.h File Reference
#include "common/darktable.h"
#include "common/dlopencl.h"
#include "common/dtpthread.h"
#include "common/iop_profile.h"
#include "control/conf.h"
#include <CL/cl.h>
+ Include dependency graph for opencl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dt_opencl_eventtag_t
 
struct  dt_opencl_device_t
 
struct  dt_opencl_t
 
struct  dt_opencl_local_buffer_t
 

Macros

#define DT_OPENCL_MAX_PLATFORMS   5
 
#define DT_OPENCL_MAX_PROGRAMS   256
 
#define DT_OPENCL_MAX_KERNELS   512
 
#define DT_OPENCL_EVENTLISTSIZE   256
 
#define DT_OPENCL_EVENTNAMELENGTH   64
 
#define DT_OPENCL_MAX_ERRORS   5
 
#define DT_OPENCL_MAX_INCLUDES   7
 
#define DT_OPENCL_VENDOR_AMD   4098
 
#define DT_OPENCL_VENDOR_NVIDIA   4318
 
#define DT_OPENCL_VENDOR_INTEL   0x8086u
 
#define DT_OPENCL_CBUFFSIZE   1024
 
#define DT_OPENCL_DEFAULT_ERROR   -999
 
#define DT_OPENCL_SYSMEM_ALLOCATION   -998
 
#define ROUNDUP(a, n)   ((a) % (n) == 0 ? (a) : ((a) / (n)+1) * (n))
 
#define ROUNDUPDWD(a, b)   dt_opencl_dev_roundup_width(a, b)
 
#define ROUNDUPDHT(a, b)   dt_opencl_dev_roundup_height(a, b)
 
#define DT_OPENCL_BPP_TAG_RGBA8   (1u << 30)
 
#define DT_OPENCL_BPP_ENCODE_RGBA8(bpp)   ((int)((unsigned int)(bpp) | DT_OPENCL_BPP_TAG_RGBA8))
 
#define DT_OPENCL_BPP_IS_RGBA8(bpp)   ((((unsigned int)(bpp)) & DT_OPENCL_BPP_TAG_RGBA8) != 0u)
 
#define DT_OPENCL_BPP_DECODE(bpp)   ((int)(((unsigned int)(bpp)) & ~DT_OPENCL_BPP_TAG_RGBA8))
 
#define DT_OPENCL_DEFAULT_COMPILE_INTEL   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
 
#define DT_OPENCL_DEFAULT_COMPILE_AMD   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
 
#define DT_OPENCL_DEFAULT_COMPILE_NVIDIA   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
 
#define DT_OPENCL_DEFAULT_COMPILE   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")
 
#define DT_CLDEVICE_HEAD   ("cldevice_v4")
 

Typedefs

typedef enum dt_opencl_memory_t dt_opencl_memory_t
 
typedef struct dt_opencl_eventtag_t dt_opencl_eventtag_t
 
typedef enum dt_opencl_pinmode_t dt_opencl_pinmode_t
 
typedef struct dt_opencl_device_t dt_opencl_device_t
 
typedef struct dt_opencl_t dt_opencl_t
 
typedef struct dt_opencl_local_buffer_t dt_opencl_local_buffer_t
 

Enumerations

enum  dt_opencl_memory_t {
  OPENCL_MEMORY_ADD ,
  OPENCL_MEMORY_SUB
}
 
enum  dt_opencl_pinmode_t {
  DT_OPENCL_PINNING_OFF = 0 ,
  DT_OPENCL_PINNING_ON = 1 ,
  DT_OPENCL_PINNING_DISABLED = 2
}
 

Functions

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)
 
void dt_opencl_init (dt_opencl_t *cl, const gboolean exclude_opencl, const gboolean print_statistics)
 
void dt_opencl_cleanup (dt_opencl_t *cl)
 
void dt_opencl_cleanup_device (dt_opencl_t *cl, int i)
 
int dt_opencl_finish (const int devid)
 
int dt_opencl_enqueue_barrier (const int devid)
 
int dt_opencl_lock_device (const int pipetype)
 
void dt_opencl_unlock_device (const int dev)
 
void dt_opencl_md5sum (const char **files, char **md5sums)
 
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)
 
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_create_kernel (const int program, const char *name)
 
void dt_opencl_free_kernel (const int kernel)
 
int dt_opencl_get_max_work_item_sizes (const int dev, size_t *sizes)
 
int dt_opencl_get_work_group_limits (const int dev, size_t *sizes, size_t *workgroupsize, unsigned long *localmemsize)
 
int dt_opencl_get_kernel_work_group_size (const int dev, const int kernel, size_t *kernelworkgroupsize)
 
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_kernel_2d (const int dev, const int kernel, const size_t *sizes)
 
int dt_opencl_enqueue_kernel_2d_with_local (const int dev, const int kernel, const size_t *sizes, const size_t *local)
 
int dt_opencl_is_inited (void)
 
int dt_opencl_is_enabled (void)
 
void dt_opencl_disable (void)
 
int dt_opencl_update_settings (void)
 
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_read_host_from_device (const int devid, void *host, void *device, const int width, const int height, const int bpp)
 
int dt_opencl_read_host_from_device_rowpitch (const int devid, void *host, void *device, const int width, const int height, const int rowpitch)
 
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_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_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)
 
int dt_opencl_write_host_to_device (const int devid, void *host, void *device, const int width, const int height, const int bpp)
 
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_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_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_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)
 
voiddt_opencl_copy_host_to_device (const int devid, void *host, const int width, const int height, const int bpp)
 
voiddt_opencl_copy_host_to_device_rowpitch (const int devid, void *host, const int width, const int height, const int bpp, const int rowpitch)
 
voiddt_opencl_copy_host_to_device_constant (const int devid, const size_t size, void *host)
 
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)
 
voiddt_opencl_alloc_device (const int devid, const int width, const int height, const int bpp)
 
voiddt_opencl_alloc_device_use_host_pointer (const int devid, const int width, const int height, const int bpp, void *host, const int flags)
 
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_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)
 
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)
 
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_write_buffer_to_device (const int devid, void *host, void *device, const size_t offset, const size_t size, const int blocking)
 
voiddt_opencl_alloc_device_buffer (const int devid, const size_t size)
 
voiddt_opencl_alloc_device_buffer_with_flags (const int devid, const size_t size, const int flags, void *host_ptr)
 
void dt_opencl_release_mem_object (cl_mem mem)
 
voiddt_opencl_map_buffer (const int devid, cl_mem buffer, const int blocking, const int flags, size_t offset, size_t size)
 
voiddt_opencl_map_image (const int devid, cl_mem buffer, const int blocking, const int flags, size_t width, size_t height, int bpp)
 
int dt_opencl_unmap_mem_object (const int devid, cl_mem mem_object, void *mapped_ptr)
 
size_t dt_opencl_get_mem_object_size (cl_mem mem)
 
int dt_opencl_get_image_width (cl_mem mem)
 
int dt_opencl_get_image_height (cl_mem mem)
 
int dt_opencl_get_image_element_size (cl_mem mem)
 
int dt_opencl_get_mem_context_id (cl_mem mem)
 
cl_mem_flags dt_opencl_get_mem_flags (cl_mem mem)
 
void dt_opencl_memory_statistics (int devid, cl_mem mem, dt_opencl_memory_t action)
 
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)
 
cl_ulong dt_opencl_get_device_available (const int devid)
 
void dt_opencl_check_tuning (const int devid)
 
cl_ulong dt_opencl_get_device_memalloc (const int devid)
 
int dt_opencl_dev_roundup_width (int size, const int devid)
 
int dt_opencl_dev_roundup_height (int size, const int devid)
 
cl_event * dt_opencl_events_get_slot (const int devid, const char *tag)
 
void dt_opencl_events_reset (const int devid)
 
void dt_opencl_events_wait_for (const int devid)
 
cl_int dt_opencl_events_flush (const int devid, const int reset)
 
void dt_opencl_events_profiling (const int devid, const int aggregated)
 
int dt_opencl_local_buffer_opt (const int devid, const int kernel, dt_opencl_local_buffer_t *factors)
 
void dt_opencl_write_device_config (const int devid)
 
gboolean dt_opencl_read_device_config (const int devid)
 
int dt_opencl_avoid_atomics (const int devid)
 
int dt_opencl_micro_nap (const int devid)
 
gboolean dt_opencl_use_pinned_memory (const int devid)
 
gboolean dt_opencl_is_pinned_memory (cl_mem mem)
 

Macro Definition Documentation

◆ DT_CLDEVICE_HEAD

#define DT_CLDEVICE_HEAD   ("cldevice_v4")

◆ DT_OPENCL_BPP_DECODE

#define DT_OPENCL_BPP_DECODE (   bpp)    ((int)(((unsigned int)(bpp)) & ~DT_OPENCL_BPP_TAG_RGBA8))

◆ DT_OPENCL_BPP_ENCODE_RGBA8

#define DT_OPENCL_BPP_ENCODE_RGBA8 (   bpp)    ((int)((unsigned int)(bpp) | DT_OPENCL_BPP_TAG_RGBA8))

◆ DT_OPENCL_BPP_IS_RGBA8

#define DT_OPENCL_BPP_IS_RGBA8 (   bpp)    ((((unsigned int)(bpp)) & DT_OPENCL_BPP_TAG_RGBA8) != 0u)

◆ DT_OPENCL_BPP_TAG_RGBA8

#define DT_OPENCL_BPP_TAG_RGBA8   (1u << 30)

◆ DT_OPENCL_CBUFFSIZE

#define DT_OPENCL_CBUFFSIZE   1024

◆ DT_OPENCL_DEFAULT_COMPILE

#define DT_OPENCL_DEFAULT_COMPILE   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")

◆ DT_OPENCL_DEFAULT_COMPILE_AMD

#define DT_OPENCL_DEFAULT_COMPILE_AMD   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")

◆ DT_OPENCL_DEFAULT_COMPILE_INTEL

#define DT_OPENCL_DEFAULT_COMPILE_INTEL   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")

◆ DT_OPENCL_DEFAULT_COMPILE_NVIDIA

#define DT_OPENCL_DEFAULT_COMPILE_NVIDIA   ("-cl-fast-relaxed-math -cl-no-signed-zeros -cl-unsafe-math-optimizations")

◆ DT_OPENCL_DEFAULT_ERROR

#define DT_OPENCL_DEFAULT_ERROR   -999

◆ DT_OPENCL_EVENTLISTSIZE

#define DT_OPENCL_EVENTLISTSIZE   256

◆ DT_OPENCL_EVENTNAMELENGTH

#define DT_OPENCL_EVENTNAMELENGTH   64

◆ DT_OPENCL_MAX_ERRORS

#define DT_OPENCL_MAX_ERRORS   5

◆ DT_OPENCL_MAX_INCLUDES

#define DT_OPENCL_MAX_INCLUDES   7

◆ DT_OPENCL_MAX_KERNELS

#define DT_OPENCL_MAX_KERNELS   512

◆ DT_OPENCL_MAX_PLATFORMS

#define DT_OPENCL_MAX_PLATFORMS   5

◆ DT_OPENCL_MAX_PROGRAMS

#define DT_OPENCL_MAX_PROGRAMS   256

◆ DT_OPENCL_SYSMEM_ALLOCATION

#define DT_OPENCL_SYSMEM_ALLOCATION   -998

◆ DT_OPENCL_VENDOR_AMD

#define DT_OPENCL_VENDOR_AMD   4098

◆ DT_OPENCL_VENDOR_INTEL

#define DT_OPENCL_VENDOR_INTEL   0x8086u

◆ DT_OPENCL_VENDOR_NVIDIA

#define DT_OPENCL_VENDOR_NVIDIA   4318

◆ ROUNDUP

#define ROUNDUP (   a,
  n 
)    ((a) % (n) == 0 ? (a) : ((a) / (n)+1) * (n))

◆ ROUNDUPDHT

#define ROUNDUPDHT (   a,
 
)    dt_opencl_dev_roundup_height(a, b)

◆ ROUNDUPDWD

#define ROUNDUPDWD (   a,
 
)    dt_opencl_dev_roundup_width(a, b)

Typedef Documentation

◆ dt_opencl_device_t

to support multi-gpu and mixed systems with cpu support, we encapsulate devices and use separate command queues.

◆ dt_opencl_eventtag_t

Accounting information used for OpenCL events.

◆ dt_opencl_local_buffer_t

description of memory requirements of local buffer local buffer size will be calculated as: (xoffset + xfactor * x) * (yoffset + yfactor * y) * cellsize + overhead;

◆ dt_opencl_memory_t

◆ dt_opencl_pinmode_t

◆ dt_opencl_t

typedef struct dt_opencl_t dt_opencl_t

main struct, stored in darktable.opencl. holds pointers to all

Enumeration Type Documentation

◆ dt_opencl_memory_t

Enumerator
OPENCL_MEMORY_ADD 
OPENCL_MEMORY_SUB 

◆ dt_opencl_pinmode_t

Enumerator
DT_OPENCL_PINNING_OFF 
DT_OPENCL_PINNING_ON 
DT_OPENCL_PINNING_DISABLED 

Function Documentation

◆ dt_opencl_alloc_device()

◆ dt_opencl_alloc_device_buffer()

◆ dt_opencl_alloc_device_buffer_with_flags()

◆ dt_opencl_alloc_device_use_host_pointer()

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 
)

◆ dt_opencl_avoid_atomics()

int dt_opencl_avoid_atomics ( const int  devid)

◆ dt_opencl_build_program()

int dt_opencl_build_program ( const int  dev,
const int  prog,
const char *  binname,
const char *  cachedir,
char *  md5sum,
int  loaded_cached 
)

◆ dt_opencl_check_tuning()

◆ dt_opencl_cleanup()

◆ dt_opencl_cleanup_device()

◆ dt_opencl_copy_device_to_host()

int dt_opencl_copy_device_to_host ( const int  devid,
void host,
void device,
const int  width,
const int  height,
const int  bpp 
)

◆ dt_opencl_copy_host_to_device()

void * dt_opencl_copy_host_to_device ( const int  devid,
void host,
const int  width,
const int  height,
const int  bpp 
)

◆ dt_opencl_copy_host_to_device_constant()

◆ dt_opencl_copy_host_to_device_rowpitch()

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 
)

◆ dt_opencl_create_kernel()

◆ dt_opencl_dev_roundup_height()

int dt_opencl_dev_roundup_height ( int  size,
const int  devid 
)

◆ dt_opencl_dev_roundup_width()

int dt_opencl_dev_roundup_width ( int  size,
const int  devid 
)

round size to a multiple of the value given in the device specifig config parameter for opencl_size_roundup

round size to a multiple of the value given in the device specifig config parameter clroundup_wd/ht

References dt_opencl_device_t::clroundup_wd, darktable, dt_opencl_t::dev, darktable_t::opencl, and size.

◆ dt_opencl_disable()

void dt_opencl_disable ( void  )

◆ dt_opencl_enqueue_barrier()

int dt_opencl_enqueue_barrier ( const int  devid)

◆ dt_opencl_enqueue_copy_buffer_to_buffer()

◆ dt_opencl_enqueue_copy_buffer_to_image()

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 
)

◆ dt_opencl_enqueue_copy_image()

◆ dt_opencl_enqueue_copy_image_to_buffer()

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 
)

◆ dt_opencl_enqueue_kernel_2d()

int dt_opencl_enqueue_kernel_2d ( const int  dev,
const int  kernel,
const size_t *  sizes 
)

launch kernel!

References dt_opencl_enqueue_kernel_2d_with_local(), and kernel().

Referenced by _downsample_guided_laplacian_postfilter_cl(), _drawlayer_run_premult_over_kernel(), _refine_with_detail_mask_cl(), _retouch_blur_cl(), _retouch_fill_cl(), _simulate_channel_cl(), apply_global_distortion_map_cl(), box_max_cl(), box_min_cl(), cl_box_mean(), cl_covariances(), cl_generate_result(), cl_solve(), cl_split_rgb(), cl_update_covariance(), cl_variances(), dehaze_cl(), dt_bilateral_blur_cl(), dt_bilateral_init_cl(), dt_bilateral_slice_cl(), dt_bilateral_slice_to_output_cl(), dt_develop_blend_process_cl(), dt_gaussian_blur_cl(), dt_iop_colorreconstruct_bilateral_blur_cl(), dt_iop_colorreconstruct_bilateral_init_cl(), dt_iop_colorreconstruct_bilateral_slice_cl(), dt_ioppr_transform_image_colorspace_cl(), dt_ioppr_transform_image_colorspace_rgb_cl(), dt_local_laplacian_cl(), dual_demosaic_cl(), dwt_add_layer_cl(), dwt_subtract_layer_cl(), dwt_wavelet_decompose_cl(), green_equilibration_cl(), nlmeans_cl_accu(), nlmeans_cl_init(), nlmeans_denoise_cl(), nlmeans_denoiseprofile_cl(), process_cl(), process_cl(), process_cl(), process_default_cl(), process_laplacian_bayer_cl(), process_laplacian_xtrans_cl(), process_markesteijn_cl(), process_nlmeans_cl(), process_rcd_cl(), process_vng_cl(), process_wavelets_cl(), reconstruct_highlights_cl(), rt_copy_image_masked_cl(), rt_copy_in_to_out_cl(), rt_copy_mask_to_alpha_cl(), transition_map_cl(), wavelets_process_cl(), and wavelets_process_cl().

◆ dt_opencl_enqueue_kernel_2d_with_local()

◆ dt_opencl_events_flush()

cl_int dt_opencl_events_flush ( const int  devid,
const int  reset 
)

Wait for events in eventlist to terminate, check for return status of events and report summary success info (CL_COMPLETE or last error code)

Wait for events in eventlist to terminate, check for return status and profiling info of events. If "reset" is TRUE report summary info (would be CL_COMPLETE or last error code) and print profiling info if needed. If "reset" is FALSE just store info (success value, profiling) from terminated events and release events for re-use by OpenCL driver.

References darktable, dt_opencl_t::dev, dt_opencl_t::dlocl, dt_dlopencl_symbols_t::dt_clGetEventInfo, dt_dlopencl_symbols_t::dt_clGetEventProfilingInfo, dt_dlopencl_symbols_t::dt_clReleaseEvent, DT_DEBUG_OPENCL, DT_DEBUG_PERF, dt_opencl_events_profiling(), dt_opencl_events_reset(), dt_opencl_events_wait_for(), dt_print(), dt_opencl_device_t::eventlist, dt_opencl_device_t::eventsconsolidated, dt_opencl_device_t::eventtags, FALSE, dt_opencl_t::inited, IS_NULL_PTR, k, dt_opencl_device_t::lostevents, dt_opencl_device_t::numevents, darktable_t::opencl, reset(), dt_opencl_device_t::summary, dt_dlopencl_t::symbols, dt_opencl_device_t::totalsuccess, darktable_t::unmuted, and dt_opencl_device_t::use_events.

Referenced by dt_dev_pixelpipe_process(), dt_opencl_events_get_slot(), and dt_opencl_finish().

◆ dt_opencl_events_get_slot()

◆ dt_opencl_events_profiling()

void dt_opencl_events_profiling ( const int  devid,
const int  aggregated 
)

display OpenCL profiling information. If summary is not 0, try to generate summarized info for kernels

display OpenCL profiling information. If "aggregated" is TRUE, try to generate summarized info for each kernel

References darktable, dt_opencl_t::dev, DT_DEBUG_OPENCL, dt_free, DT_OPENCL_EVENTNAMELENGTH, dt_print(), dt_opencl_device_t::eventlist, dt_opencl_device_t::eventsconsolidated, dt_opencl_device_t::eventtags, i, dt_opencl_t::inited, IS_NULL_PTR, items, k, dt_opencl_device_t::lostevents, dt_opencl_device_t::name, dt_opencl_device_t::numevents, darktable_t::opencl, and dt_opencl_device_t::use_events.

Referenced by dt_opencl_events_flush().

◆ dt_opencl_events_reset()

◆ dt_opencl_events_wait_for()

void dt_opencl_events_wait_for ( const int  devid)

Wait for events in eventlist to terminate -> this is a blocking synchronization point Does not flush eventlist

Wait for events in eventlist to terminate -> this is a blocking synchronization point! Does not flush eventlist. Side effect: might adjust numevents.

Todo:
: run clWaitForEvents in separate thread and implement watchdog timer

References darktable, dt_opencl_t::dev, dt_opencl_t::dlocl, dt_dlopencl_symbols_t::dt_clWaitForEvents, DT_DEBUG_OPENCL, dt_vprint(), dt_opencl_device_t::eventlist, dt_opencl_device_t::eventsconsolidated, dt_opencl_t::inited, IS_NULL_PTR, dt_opencl_device_t::lostevents, dt_opencl_device_t::numevents, darktable_t::opencl, dt_dlopencl_t::symbols, dt_opencl_device_t::totallost, and dt_opencl_device_t::use_events.

Referenced by dt_dev_pixelpipe_cache_flush_clmem(), dt_dev_pixelpipe_cache_flush_host_pinned_image(), dt_dev_pixelpipe_cache_prepare_cl_input(), and dt_opencl_events_flush().

◆ dt_opencl_finish()

◆ dt_opencl_free_kernel()

◆ dt_opencl_get_device_available()

◆ dt_opencl_get_device_info()

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 
)

internally calls dt_clGetDeviceInfo, and takes care of memory allocation afterwards, *param_value will point to memory block of size at least *param_value which needs to be g_free()'d manually

Todo:
: anything better?

References dt_opencl_t::dlocl, dt_dlopencl_symbols_t::dt_clGetDeviceInfo, DT_DEBUG_OPENCL, dt_free, dt_print(), error(), IS_NULL_PTR, and dt_dlopencl_t::symbols.

Referenced by dt_opencl_device_init().

◆ dt_opencl_get_device_memalloc()

cl_ulong dt_opencl_get_device_memalloc ( const int  devid)

◆ dt_opencl_get_image_element_size()

◆ dt_opencl_get_image_height()

◆ dt_opencl_get_image_width()

◆ dt_opencl_get_kernel_work_group_size()

int dt_opencl_get_kernel_work_group_size ( const int  dev,
const int  kernel,
size_t *  kernelworkgroupsize 
)

◆ dt_opencl_get_max_work_item_sizes()

int dt_opencl_get_max_work_item_sizes ( const int  dev,
size_t *  sizes 
)

◆ dt_opencl_get_mem_context_id()

◆ dt_opencl_get_mem_flags()

◆ dt_opencl_get_mem_object_size()

◆ dt_opencl_get_work_group_limits()

int dt_opencl_get_work_group_limits ( const int  dev,
size_t *  sizes,
size_t *  workgroupsize,
unsigned long *  localmemsize 
)

◆ dt_opencl_image_fits_device()

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 
)

◆ dt_opencl_init()

void dt_opencl_init ( dt_opencl_t cl,
const gboolean  exclude_opencl,
const gboolean  print_statistics 
)

inits the opencl subsystem.

References _opencl_splash_active, dt_opencl_t::bilateral, dt_opencl_t::blendop, dt_opencl_t::colorspaces, dt_opencl_t::crc, dt_opencl_t::dev, dt_opencl_t::dev_priority_export, dt_opencl_t::dev_priority_image, dt_opencl_t::dev_priority_preview, dt_opencl_t::dev_priority_thumbnail, dt_opencl_t::dlocl, dt_bilateral_init_cl_global(), dt_capabilities_add(), dt_dlopencl_symbols_t::dt_clGetDeviceIDs, dt_dlopencl_symbols_t::dt_clGetPlatformIDs, dt_dlopencl_symbols_t::dt_clGetPlatformInfo, dt_colorspaces_init_cl_global(), dt_conf_get_bool(), dt_conf_get_int(), dt_conf_get_string_const(), DT_DEBUG_OPENCL, dt_develop_blend_init_cl_global(), dt_dlopencl_init(), dt_dwt_init_cl_global(), dt_free, dt_gaussian_init_cl_global(), dt_guided_filter_init_cl_global(), dt_heal_init_cl_global(), dt_interpolation_init_cl_global(), dt_local_laplacian_init_cl_global(), dt_opencl_apply_scheduling_profile(), DT_OPENCL_CBUFFSIZE, dt_opencl_cleanup_device(), dt_opencl_device_init(), DT_OPENCL_MAX_PLATFORMS, dt_print_nts(), dt_pthread_mutex_init(), dt_opencl_t::dwt, dt_opencl_t::enabled, dt_opencl_t::error_count, FALSE, dt_opencl_t::gaussian, dt_opencl_t::guided_filter, dt_opencl_t::heal, i, dt_opencl_t::inited, dt_opencl_t::interpolation, IS_NULL_PTR, k, dt_dlopencl_t::library, dt_opencl_t::local_laplacian, dt_opencl_t::lock, dt_opencl_t::mandatory, n, dt_opencl_device_t::name, dt_opencl_t::num_devs, dt_opencl_t::print_statistics, dt_opencl_t::stopped, and dt_dlopencl_t::symbols.

Referenced by dt_init().

◆ dt_opencl_is_enabled()

int dt_opencl_is_enabled ( void  )

check if opencl is enabled

References darktable, dt_opencl_t::enabled, FALSE, dt_opencl_t::inited, and darktable_t::opencl.

Referenced by _get_base_value().

◆ dt_opencl_is_inited()

int dt_opencl_is_inited ( void  )

check if opencl is inited

References darktable, dt_opencl_t::inited, and darktable_t::opencl.

Referenced by _is_opencl_supported(), and _seal_opencl_cache_policy().

◆ dt_opencl_is_pinned_memory()

◆ dt_opencl_load_program()

◆ dt_opencl_local_buffer_opt()

◆ dt_opencl_lock_device()

◆ dt_opencl_map_buffer()

void * dt_opencl_map_buffer ( const int  devid,
cl_mem  buffer,
const int  blocking,
const int  flags,
size_t  offset,
size_t  size 
)

◆ dt_opencl_map_image()

◆ dt_opencl_md5sum()

void dt_opencl_md5sum ( const char **  files,
char **  md5sums 
)

calculates md5sums for a list of CL include files.

References dt_concat_path_file(), DT_DEBUG_OPENCL, dt_free, dt_loc_get_kerneldir(), DT_OPENCL_MAX_INCLUDES, dt_print(), f, fopen_stat(), IS_NULL_PTR, n, and PATH_MAX.

Referenced by dt_opencl_device_init().

◆ dt_opencl_memory_statistics()

◆ dt_opencl_micro_nap()

int dt_opencl_micro_nap ( const int  devid)

◆ dt_opencl_read_buffer_from_device()

◆ dt_opencl_read_device_config()

◆ dt_opencl_read_host_from_device()

int dt_opencl_read_host_from_device ( const int  devid,
void host,
void device,
const int  width,
const int  height,
const int  bpp 
)

◆ dt_opencl_read_host_from_device_non_blocking()

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 
)

◆ dt_opencl_read_host_from_device_raw()

◆ dt_opencl_read_host_from_device_rowpitch()

int dt_opencl_read_host_from_device_rowpitch ( const int  devid,
void host,
void device,
const int  width,
const int  height,
const int  rowpitch 
)

◆ dt_opencl_read_host_from_device_rowpitch_non_blocking()

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 
)

◆ dt_opencl_release_mem_object()

void dt_opencl_release_mem_object ( cl_mem  mem)

References darktable, dt_opencl_t::dlocl, dt_dlopencl_symbols_t::dt_clReleaseMemObject, dt_opencl_memory_statistics(), dt_opencl_t::inited, IS_NULL_PTR, darktable_t::opencl, OPENCL_MEMORY_SUB, and dt_dlopencl_t::symbols.

Referenced by _blend_layer_over_input_cl(), _cache_entry_clmem_flush_device(), _cache_entry_clmem_flush_host_pinned_locked(), _default_process_tiling_cl_ptp(), _default_process_tiling_cl_roi(), _downsample_guided_laplacian_postfilter_cl(), _drawlayer_acquire_source_image(), _pixel_cache_clmem_put(), _refine_with_detail_mask_cl(), _retouch_blur_cl(), _retouch_clone_cl(), _retouch_fill_cl(), _retouch_heal_cl(), _simulate_channel_cl(), apply_global_distortion_map_cl(), box_max_cl(), box_min_cl(), color_smoothing_cl(), dt_bilateral_free_cl(), dt_bilateral_slice_to_output_cl(), dt_dev_pixelpipe_cache_flush_entry_clmem(), dt_dev_pixelpipe_cache_get_pinned_image(), dt_dev_pixelpipe_cache_release_cl_buffer(), dt_develop_blend_process_cl(), dt_gaussian_free_cl(), dt_gaussian_init_cl(), dt_interpolation_resample_cl(), dt_iop_colorreconstruct_bilateral_free_cl(), dt_ioppr_free_iccprofile_params_cl(), dt_ioppr_transform_image_colorspace_cl(), dt_ioppr_transform_image_colorspace_rgb_cl(), dt_local_laplacian_free_cl(), dual_demosaic_cl(), dwt_wavelet_decompose_cl(), green_equilibration_cl(), guided_filter_cl_impl(), nlmeans_denoise_cl(), nlmeans_denoiseprofile_cl(), process_cl(), process_cl(), process_cl(), process_default_cl(), process_laplacian_bayer_cl(), process_laplacian_xtrans_cl(), process_markesteijn_cl(), process_nlmeans_cl(), process_rcd_cl(), process_vng_cl(), process_wavelets_cl(), reconstruct_highlights_cl(), rt_copy_image_masked_cl(), rt_copy_in_to_out_cl(), rt_copy_mask_to_alpha_cl(), and rt_process_forms_cl().

◆ dt_opencl_set_kernel_arg()

int dt_opencl_set_kernel_arg ( const int  dev,
const int  kernel,
const int  num,
const size_t  size,
const void arg 
)

attach arg.

References darktable, dt_opencl_t::dev, dt_opencl_t::dlocl, dt_dlopencl_symbols_t::dt_clSetKernelArg, DT_OPENCL_MAX_KERNELS, dt_opencl_t::inited, kernel(), dt_opencl_device_t::kernel, darktable_t::opencl, size, and dt_dlopencl_t::symbols.

Referenced by _downsample_guided_laplacian_postfilter_cl(), _drawlayer_run_premult_over_kernel(), _refine_with_detail_mask_cl(), _retouch_blur_cl(), _retouch_fill_cl(), _simulate_channel_cl(), apply_global_distortion_map_cl(), box_max_cl(), box_min_cl(), cl_box_mean(), cl_covariances(), cl_generate_result(), cl_solve(), cl_split_rgb(), cl_update_covariance(), cl_variances(), color_smoothing_cl(), dehaze_cl(), dt_bilateral_blur_cl(), dt_bilateral_init_cl(), dt_bilateral_slice_cl(), dt_bilateral_slice_to_output_cl(), dt_bilateral_splat_cl(), dt_develop_blend_process_cl(), dt_gaussian_blur_cl(), dt_interpolation_resample_cl(), dt_iop_colorreconstruct_bilateral_blur_cl(), dt_iop_colorreconstruct_bilateral_init_cl(), dt_iop_colorreconstruct_bilateral_slice_cl(), dt_iop_colorreconstruct_bilateral_splat_cl(), dt_ioppr_transform_image_colorspace_cl(), dt_ioppr_transform_image_colorspace_rgb_cl(), dt_local_laplacian_cl(), dual_demosaic_cl(), dwt_add_layer_cl(), dwt_subtract_layer_cl(), dwt_wavelet_decompose_cl(), green_equilibration_cl(), nlmeans_cl_accu(), nlmeans_cl_horiz(), nlmeans_cl_init(), nlmeans_denoise_cl(), nlmeans_denoiseprofile_cl(), process_cl(), process_cl(), process_cl(), process_default_cl(), process_laplacian_bayer_cl(), process_laplacian_xtrans_cl(), process_markesteijn_cl(), process_nlmeans_cl(), process_rcd_cl(), process_vng_cl(), process_wavelets_cl(), reconstruct_highlights_cl(), rt_copy_image_masked_cl(), rt_copy_in_to_out_cl(), rt_copy_mask_to_alpha_cl(), transition_map_cl(), wavelets_process_cl(), and wavelets_process_cl().

◆ dt_opencl_unlock_device()

void dt_opencl_unlock_device ( const int  dev)

◆ dt_opencl_unmap_mem_object()

◆ dt_opencl_update_settings()

int dt_opencl_update_settings ( void  )

update enabled flag and profile with value from preferences, returns enabled flag

Todo:
: This pulls in prefs every time the pixelpipe runs. Instead have a callback for DT_SIGNAL_PREFERENCES_CHANGE?

References darktable, dt_conf_get_bool(), DT_DEBUG_OPENCL, dt_print(), dt_opencl_t::enabled, dt_opencl_t::error_count, FALSE, dt_opencl_t::inited, darktable_t::opencl, and dt_opencl_t::stopped.

Referenced by dt_dev_pixelpipe_process().

◆ dt_opencl_use_pinned_memory()

◆ dt_opencl_write_buffer_to_device()

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 
)

◆ dt_opencl_write_device_config()

◆ dt_opencl_write_host_to_device()

◆ dt_opencl_write_host_to_device_non_blocking()

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 
)

◆ dt_opencl_write_host_to_device_raw()

◆ dt_opencl_write_host_to_device_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 
)

◆ dt_opencl_write_host_to_device_rowpitch_non_blocking()

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 
)