26 #if defined(OP) && defined(VEC_SIZE_IN1) && defined(VEC_SIZE_IN2) && defined(VEC_SIZE_OUT) && defined(DATA_TYPE_IN1) && defined(DATA_TYPE_IN2) && defined(DATA_TYPE_OUT) 31 #define ADD(x, y) add_sat((x), (y)) 32 #define SUB(x, y) sub_sat((x), (y)) 34 #define ADD(x, y) (x) + (y) 35 #define SUB(x, y) (x) - (y) 38 #define MAX(x, y) max(x, y) 39 #define MIN(x, y) min(x, y) 40 #define SQUARED_DIFF(x, y) (x - y) * (x - y) 41 #define DIV(x, y) (x / y) 42 #define POWER(x, y) pow(x, y) 43 #define PRELU(x, y) (select(y * x, x, CONVERT((x > (DATA_TYPE_OUT)0), SELECT_VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT)))) 45 #define AND(x, y) (CONVERT((x && y), VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT)) & ((VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT))1)) 46 #define OR(x, y) (CONVERT((x || y), VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT)) & ((VEC_DATA_TYPE(DATA_TYPE_OUT, VEC_SIZE_OUT))1)) 48 #define OP_FUN_NAME_STR(op) elementwise_operation_##op 49 #define OP_FUN_NAME(op) OP_FUN_NAME_STR(op) 51 #if defined(ACTIVATION_TYPE) 53 #endif // defined(ACTIVATION_TYPE) 96 #else // VEC_SIZE_IN1 == 1 97 uint in1_x_offs = max((
int)(get_global_id(0) * VEC_SIZE_IN1 - (VEC_SIZE_IN1 - VEC_SIZE_LEFTOVER) % VEC_SIZE_IN1), 0);
98 #endif // VEC_SIZE_IN1 == 1 101 #else // VEC_SIZE_IN2 == 1 102 uint in2_x_offs = max((
int)(get_global_id(0) * VEC_SIZE_IN2 - (VEC_SIZE_IN2 - VEC_SIZE_LEFTOVER) % VEC_SIZE_IN2), 0);
103 #endif // VEC_SIZE_IN2 == 1 104 uint out_x_offs = max((
int)(get_global_id(0) * VEC_SIZE_OUT - (VEC_SIZE_OUT - VEC_SIZE_LEFTOVER) % VEC_SIZE_OUT), 0);
107 __global uchar *in1_addr = in1_ptr + in1_offset_first_element_in_bytes + in1_x_offs *
sizeof(DATA_TYPE_IN1) + get_global_id(1) * in1_step_y + get_global_id(2) * in1_step_z;
108 __global uchar *in2_addr = in2_ptr + in2_offset_first_element_in_bytes + in2_x_offs *
sizeof(DATA_TYPE_IN2) + get_global_id(1) * in2_step_y + get_global_id(2) * in2_step_z;
109 __global uchar *out_addr = out_ptr + out_offset_first_element_in_bytes + out_x_offs *
sizeof(
DATA_TYPE_OUT) + get_global_id(1) * out_step_y + get_global_id(2) * out_step_z;
119 res0 = OP(in_a, in_b);
120 #if defined(ACTIVATION_TYPE) 122 #endif // defined(ACTIVATION_TYPE)
#define STORE_VECTOR_SELECT(basename, data_type, ptr, vec_size, leftover, cond)
Store a vector that can only be partial in x.
#define TENSOR3D_DECLARATION(name)
#define ACTIVATION(op, DATA_TYPE, VEC_SIZE, x, A_VAL, B_VAL)
#define VEC_DATA_TYPE(type, size)