Blame view

src/kernels/cl_aux_functions.h 3.65 KB
94b2b13d   Pedro Roque   PHACT source
1
2
3
4
/*
 * aux_functions.h
 *
 *  Created on: 06/03/2016
4d26a735   Pedro Roque   Increased recogni...
5
 *      Author: pedro
94b2b13d   Pedro Roque   PHACT source
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 */

#ifndef SRC_KERNELS_CL_AUX_FUNCTIONS_H_
#define SRC_KERNELS_CL_AUX_FUNCTIONS_H_

#ifndef __OPENCL_VERSION__
#include <sys/types.h>

#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
4d26a735   Pedro Roque   Increased recogni...
58
 * hist_tree_level - next tree level to fill
94b2b13d   Pedro Roque   PHACT source
59
60
61
62
63
 */
#define GET_CURR_TREE_LEVEL_IDX(t) ((t) * CL_N_VS)

/*
 * Return the first index of the previous tree level
4d26a735   Pedro Roque   Increased recogni...
64
 * hist_tree_level - next tree level to fill
94b2b13d   Pedro Roque   PHACT source
65
66
67
68
69
 */
#define GET_PREV_TREE_LEVEL_IDX(t) (((t) - 1) * CL_N_VS)

#ifndef __OPENCL_VERSION__

4d26a735   Pedro Roque   Increased recogni...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
94b2b13d   Pedro Roque   PHACT source
98
		, CL_INTS_MEM int* c_consts
4d26a735   Pedro Roque   Increased recogni...
99
100
101
102
#endif
#if CL_D_TYPE == CL_BITMAP
		, CL_B_DS_MEM cl_bitmap* b_ds
#endif
94b2b13d   Pedro Roque   PHACT source
103
104
		);
#endif
4d26a735   Pedro Roque   Increased recogni...
105

94b2b13d   Pedro Roque   PHACT source
106
107
108
void get_new_str( __global unsigned int* atoms,
		CL_VS_MEM VARS* vs,
		__global DOMAIN_* hist,
4d26a735   Pedro Roque   Increased recogni...
109
110
111
112
		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
94b2b13d   Pedro Roque   PHACT source
113
114
115
#endif
#if (CS_MAXIMIZE == 1 || CS_MINIMIZE == 1) && CL_WORK == CL_OPT
		, __global unsigned int* val_to_opt_g
4d26a735   Pedro Roque   Increased recogni...
116
#endif
94b2b13d   Pedro Roque   PHACT source
117
118
119
120
		,__global int* ss_aux_mem TTL_CTR);

#endif

4d26a735   Pedro Roque   Increased recogni...
121
#endif /* SRC_KERNELS_CL_AUX_FUNCTIONS_H_ */
94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source

4d26a735   Pedro Roque   Increased recogni...

94b2b13d   Pedro Roque   PHACT source