/* * aux_functions.h * * Created on: 06/03/2016 * Author: pedro */ #ifndef SRC_KERNELS_CL_AUX_FUNCTIONS_H_ #define SRC_KERNELS_CL_AUX_FUNCTIONS_H_ #ifndef __OPENCL_VERSION__ #include #include "../config.h" #include "../domains.h" #include "cl_ttl.h" #include "cl_variables.h" #include "cl_constraints.h" #endif #define CL_PRINT_CSP 0 // 1 to print the CSP as received in the device, 0 to not print // For shared SS flags #define EMPTY 0 #define FILLED 1 #define LW_L(a) ((__local unsigned int *)a)[0] // lower 32bits - lower word #define UW_L(a) ((__local unsigned int *)a)[1] // upper 32bits - upper word #define LW_G(a) ((__global unsigned int *)a)[0] // lower 32bits - lower word #define UW_G(a) ((__global unsigned int *)a)[1] // upper 32bits - upper word #if CL_CS_IGNORE == 1 #define CS_IGNORE_CALL , cs_ignore #define CS_IGNORE_FUNC , __global char* cs_ignore #else #define CS_IGNORE_CALL #define CS_IGNORE_FUNC #endif #if CL_STATS == 1 #define PROPAGATED_CALL , &propagated #define PROPAGATED_FUNC , bool* propagated #else #define PROPAGATED_CALL #define PROPAGATED_FUNC #endif /* * Return the first index of the tree level that is not filled yet * hist_tree_level - next tree level to fill */ #define GET_CURR_TREE_LEVEL_IDX(t) ((t) * CL_N_VS) /* * Return the first index of the previous tree level * hist_tree_level - next tree level to fill */ #define GET_PREV_TREE_LEVEL_IDX(t) (((t) - 1) * CL_N_VS) #ifndef __OPENCL_VERSION__ void v_add_to_prop(CL_MEMORY unsigned short* vs_id_to_prop_, CL_MEMORY VARS_PROP* vs_prop_, int v_id_to_prop); void v_get_id_to_prop(CL_MEMORY unsigned short* vs_id_to_prop_, CL_MEMORY VARS_PROP* vs_prop_, unsigned int* prop_v_id TTL_CTR); void v_get_id_to_label(CL_MEMORY VARS_PROP* vs_prop_, CL_VS_MEM VARS* vs, unsigned int* prop_v_id TTL_CTR); void v_assign(CL_MEMORY VARS_PROP* v, __global DOMAIN_* hist, __global int* hist_labeleds_n_vals TTL_CTR); #if CL_WORK == CL_OPT void upd_opt_var_hist_g(__global DOMAIN_* hist, __global unsigned int* val_to_opt TTL_CTR); #endif #if CL_N_SHARED_SS > 0 void get_shared_store( __global DOMAIN_* shared_ss, __global int* shared_ss_flags, CL_MEMORY unsigned short* vs_id_to_prop_, CL_MEMORY VARS_PROP* vs_prop_, __global DOMAIN_* hist, int* hist_tree_level, __global int* hist_labeleds_id, __global int* hist_labeleds_n_vals, unsigned int* prop_v_id TTL_CTR); void set_shared_store( __global DOMAIN_* shared_ss, __global int* shared_ss_flags, CL_MEMORY VARS_PROP* vs_prop_, int v_id, __global DOMAIN_* hist, __global int* hist_labeleds_n_vals TTL_CTR); #endif #if CL_CS_IGNORE void clear_cs_ignore(__global char* cs_ignore); #endif #if CL_PRINT_CSP void cs_print_type_device(CL_CS_MEM cl_constr* cs); void print_CSP_device(CL_VS_MEM VARS* vs, CL_CS_MEM cl_constr* cs, CL_INTS_MEM int* cs_per_v_idx, CL_INTS_MEM int* vs_per_c_idx #if CS_AT_LEAST == 1 || CS_AT_MOST == 1 || CS_AT_MOST_ONE == 1 || CS_EXACTLY == 1 || CS_LINEAR == 1 || CS_LINEAR_LT == 1 || CS_LINEAR_NE == 1 || CS_LINEAR_VAR == 1 || CS_ELEMENT_INT_VAR == 1 , CL_INTS_MEM int* c_consts #endif #if CL_D_TYPE == CL_BITMAP , CL_B_DS_MEM cl_bitmap* b_ds #endif ); #endif void get_new_str( __global unsigned int* atoms, CL_VS_MEM VARS* vs, __global DOMAIN_* hist, CL_MEMORY VARS_PROP* vs_prop_, CL_MEMORY unsigned short* vs_id_to_prop_, int* hist_tree_level, __global int* hist_labeleds_id, __global int* hist_labeleds_n_vals, unsigned int* prop_v_id #if CL_D_TYPE == CL_BITMAP , CL_B_DS_MEM cl_bitmap* b_ds #endif #if (CS_MAXIMIZE == 1 || CS_MINIMIZE == 1) && CL_WORK == CL_OPT , __global unsigned int* val_to_opt_g #endif ,__global int* ss_aux_mem TTL_CTR); #endif #endif /* SRC_KERNELS_CL_AUX_FUNCTIONS_H_ */