From: Andreas Beckmann Date: Fri, 5 Feb 2021 17:06:40 +0000 (+0100) Subject: [PATCH 12/13] add POCL_EXPORT decorations X-Git-Tag: archive/raspbian/1.6-5+rpi1^2~14 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f39c0d293d41f1c5bb1687e619c1830c323a2c60;p=pocl.git [PATCH 12/13] add POCL_EXPORT decorations this is the minimal set needed for building the basic and pthread devices with -fvisibility=hidden Gbp-Pq: Name 0012-add-POCL_EXPORT-decorations.patch --- diff --git a/include/pocl.h b/include/pocl.h index 8c4280e..128ee42 100644 --- a/include/pocl.h +++ b/include/pocl.h @@ -40,6 +40,8 @@ #include "config.h" +#include "pocl_export.h" + #include "pocl_context.h" /* detects restrict, variadic macros etc */ diff --git a/lib/CL/devices/common.h b/lib/CL/devices/common.h index 239e69c..7b2bc0d 100644 --- a/lib/CL/devices/common.h +++ b/lib/CL/devices/common.h @@ -64,9 +64,11 @@ int llvm_codegen (char *output, unsigned device_i, cl_kernel kernel, cl_device_id device, _cl_command_node *command, int specialize); +POCL_EXPORT void pocl_fill_dev_image_t (dev_image_t *di, struct pocl_argument *parg, cl_device_id device); +POCL_EXPORT void pocl_fill_dev_sampler_t (dev_sampler_t *ds, struct pocl_argument *parg); void pocl_copy_mem_object (cl_device_id dest_dev, cl_mem dest, @@ -79,33 +81,42 @@ void pocl_migrate_mem_objects (_cl_command_node *node); void pocl_scheduler (_cl_command_node * volatile * ready_list, pthread_mutex_t *lock_ptr); +POCL_EXPORT void pocl_exec_command (_cl_command_node * volatile node); +POCL_EXPORT void pocl_ndrange_node_cleanup(_cl_command_node *node); void pocl_mem_objs_cleanup (cl_event event); +POCL_EXPORT void pocl_broadcast (cl_event event); +POCL_EXPORT void pocl_init_dlhandle_cache (); char *pocl_check_kernel_disk_cache (_cl_command_node *cmd, int specialized); size_t pocl_cmd_max_grid_dim_width (_cl_command_run *cmd); +POCL_EXPORT void pocl_check_kernel_dlhandle_cache (_cl_command_node *command, unsigned initial_refcount, int specialize); +POCL_EXPORT void pocl_release_dlhandle_cache (_cl_command_node *cmd); void pocl_setup_device_for_system_memory(cl_device_id device); void pocl_reinit_system_memory(); +POCL_EXPORT void pocl_set_buffer_image_limits(cl_device_id device); +POCL_EXPORT void* pocl_aligned_malloc_global_mem(cl_device_id device, size_t align, size_t size); +POCL_EXPORT void pocl_free_global_mem(cl_device_id device, void *ptr, size_t size); void pocl_print_system_memory_stats(); @@ -113,6 +124,7 @@ void pocl_print_system_memory_stats(); void pocl_calculate_kernel_hash (cl_program program, unsigned kernel_i, unsigned device_i); +POCL_EXPORT void pocl_init_default_device_infos (cl_device_id dev); #ifdef __cplusplus diff --git a/lib/CL/devices/cpuinfo.h b/lib/CL/devices/cpuinfo.h index 152793d..a63d582 100644 --- a/lib/CL/devices/cpuinfo.h +++ b/lib/CL/devices/cpuinfo.h @@ -32,6 +32,7 @@ #include "pocl_cl.h" +POCL_EXPORT void pocl_cpuinfo_detect_device_info(cl_device_id device); #endif /* POCL_TOPOLOGY_H */ diff --git a/lib/CL/devices/devices.h b/lib/CL/devices/devices.h index bbb0a66..e15f3c4 100644 --- a/lib/CL/devices/devices.h +++ b/lib/CL/devices/devices.h @@ -68,6 +68,7 @@ unsigned int pocl_get_devices(cl_device_type device_type, struct _cl_device_id * * \return If the env var was not set, return -1, if the env var is specified, return 0 * or the number of occurrence of dev_type in the env var */ +POCL_EXPORT int pocl_device_get_env_count(const char *dev_type); /** diff --git a/lib/CL/devices/pocl_local_size.h b/lib/CL/devices/pocl_local_size.h index 0fb7316..359a195 100644 --- a/lib/CL/devices/pocl_local_size.h +++ b/lib/CL/devices/pocl_local_size.h @@ -27,6 +27,7 @@ #include "pocl_cl.h" /* The generic local size optimizer used by default, in case there's no target * specific one defined in the device driver. */ +POCL_EXPORT void pocl_default_local_size_optimizer (cl_device_id dev, size_t global_x, size_t global_y, size_t global_z, size_t *local_x, size_t *local_y, diff --git a/lib/CL/devices/prototypes.inc b/lib/CL/devices/prototypes.inc index 91987eb..80c584e 100644 --- a/lib/CL/devices/prototypes.inc +++ b/lib/CL/devices/prototypes.inc @@ -31,6 +31,7 @@ void pocl_##__DRV__##_wait_event (cl_device_id device, cl_event event); \ void pocl_##__DRV__##_update_event (cl_device_id device, cl_event event); \ void pocl_##__DRV__##_free_event_data (cl_event event); \ + POCL_EXPORT \ void pocl_##__DRV__##_init_device_ops (struct pocl_device_ops *ops); \ cl_int pocl_##__DRV__##_uninit (unsigned j, cl_device_id device); \ cl_int pocl_##__DRV__##_reinit (unsigned j, cl_device_id device); \ diff --git a/lib/CL/devices/topology/pocl_topology.h b/lib/CL/devices/topology/pocl_topology.h index cc390f9..159ba30 100644 --- a/lib/CL/devices/topology/pocl_topology.h +++ b/lib/CL/devices/topology/pocl_topology.h @@ -33,6 +33,7 @@ #include "pocl_cl.h" +POCL_EXPORT int pocl_topology_detect_device_info(cl_device_id device); #endif /* POCL_TOPOLOGY_H */ diff --git a/lib/CL/pocl_debug.h b/lib/CL/pocl_debug.h index 718cc39..c0d1e63 100644 --- a/lib/CL/pocl_debug.h +++ b/lib/CL/pocl_debug.h @@ -17,6 +17,8 @@ #include "config.h" +#include "pocl_export.h" + // size_t print spec #ifndef PRIuS # define PRIuS "zu" @@ -105,7 +107,9 @@ extern "C" { #ifdef POCL_DEBUG_MESSAGES +POCL_EXPORT extern uint64_t pocl_debug_messages_filter; +POCL_EXPORT extern int pocl_stderr_is_a_tty; #define POCL_DEBUGGING_ON (pocl_debug_messages_filter) @@ -118,9 +122,12 @@ extern "C" { #define POCL_DEBUG_HEADER(FILTER, FILTER_TYPE) \ pocl_debug_print_header (__func__, __LINE__, #FILTER, FILTER_TYPE); +POCL_EXPORT extern void pocl_debug_output_lock (); +POCL_EXPORT extern void pocl_debug_output_unlock (); extern void pocl_debug_messages_setup (const char *debug); +POCL_EXPORT extern void pocl_debug_print_header (const char * func, unsigned line, const char* filter, int filter_type); extern void pocl_debug_measure_start (uint64_t* start); diff --git a/lib/CL/pocl_llvm.h b/lib/CL/pocl_llvm.h index bd1d47f..960aca6 100644 --- a/lib/CL/pocl_llvm.h +++ b/lib/CL/pocl_llvm.h @@ -30,6 +30,7 @@ extern "C" { #endif /* Returns the cpu name as reported by LLVM. */ +POCL_EXPORT char *get_llvm_cpu_name (); /* Returns if the cpu supports FMA instruction (uses LLVM). */ int cpu_has_fma(); diff --git a/lib/CL/pocl_llvm_api.h b/lib/CL/pocl_llvm_api.h index d3bf44e..b33241a 100644 --- a/lib/CL/pocl_llvm_api.h +++ b/lib/CL/pocl_llvm_api.h @@ -65,6 +65,7 @@ public: }; +POCL_EXPORT extern cl_device_id currentPoclDevice; void InitializeLLVM(); diff --git a/lib/CL/pocl_runtime_config.h b/lib/CL/pocl_runtime_config.h index eb54dd9..7f47c13 100644 --- a/lib/CL/pocl_runtime_config.h +++ b/lib/CL/pocl_runtime_config.h @@ -25,12 +25,16 @@ #ifndef _POCL_RUNTIME_CONFIG_H #define _POCL_RUNTIME_CONFIG_H +#include "pocl_export.h" + #ifdef __cplusplus extern "C" { #endif int pocl_is_option_set(const char *key); +POCL_EXPORT int pocl_get_int_option(const char *key, int default_value); +POCL_EXPORT int pocl_get_bool_option(const char *key, int default_value); const char* pocl_get_string_option(const char *key, const char *default_value); diff --git a/lib/CL/pocl_util.h b/lib/CL/pocl_util.h index ce10460..c35c908 100644 --- a/lib/CL/pocl_util.h +++ b/lib/CL/pocl_util.h @@ -57,17 +57,23 @@ uint32_t byteswap_uint32_t (uint32_t word, char should_swap); float byteswap_float (float word, char should_swap); /* set rounding mode */ +POCL_EXPORT void pocl_restore_rm (unsigned rm); /* get current rounding mode */ +POCL_EXPORT unsigned pocl_save_rm (); /* set OpenCL's default (round to nearest) rounding mode */ +POCL_EXPORT void pocl_set_default_rm (); /* sets the flush-denorms-to-zero flag on the CPU, if supported */ +POCL_EXPORT void pocl_set_ftz (unsigned ftz); /* saves / restores cpu flags*/ +POCL_EXPORT unsigned pocl_save_ftz (); +POCL_EXPORT void pocl_restore_ftz (unsigned ftz); /* Finds the next highest power of two of the given value. */ @@ -83,6 +89,7 @@ uint64_t pocl_size_ceil2_64 (uint64_t x); * must be a non-zero power of 2. */ +POCL_EXPORT void *pocl_aligned_malloc(size_t alignment, size_t size); #define pocl_aligned_free(x) POCL_MEM_FREE(x) @@ -131,6 +138,7 @@ check_copy_overlap(const size_t src_offset[3], * Push a command into ready list if all previous events are completed or * in pending_list if the command still has pending dependencies */ +POCL_EXPORT void pocl_command_push (_cl_command_node *node, _cl_command_node * volatile * ready_list, @@ -182,12 +190,15 @@ void pocl_abort_on_pthread_error (int status, unsigned line, const char *func); void pocl_update_event_queued (cl_event event); +POCL_EXPORT void pocl_update_event_submitted (cl_event event); void pocl_update_event_running_unlocked (cl_event event); +POCL_EXPORT void pocl_update_event_running (cl_event event); +POCL_EXPORT void pocl_update_event_complete_msg (const char *func, unsigned line, cl_event event, const char *msg); @@ -197,6 +208,7 @@ void pocl_update_event_complete_msg (const char *func, unsigned line, #define POCL_UPDATE_EVENT_COMPLETE(__event) \ pocl_update_event_complete_msg (__func__, __LINE__, (__event), NULL); +POCL_EXPORT void pocl_update_event_failed (cl_event event); const char*