#include "opencl_source_map.hpp" namespace MNN { const char* binary = "#ifdef MNN_SUPPORT_FP16\n" "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" "#endif\n" "#define PI 3.141592653589f\n" "__constant sampler_t SAMPLER=CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;\n" "__kernel void binary(__private int global_dim0,__private int global_dim1,\n" " __read_only image2d_t input0,__read_only image2d_t input1,\n" " __write_only image2d_t output,\n" " __private const int4 shape,//[N,H,W,C4]\n" " __private const int2 isFull,\n" " __private const int activationType) {\n" " int2 pos=(int2)(get_global_id(0),get_global_id(1));//WC4,NH\n" " \n" " #ifdef INT_COMPUTE_MOD\n" " int4 in0,in1;\n" " if (pos.x(int4)0) || (out>(int4)0 && in1<(int4)0)) ? out+in1 : out;\n" " \n" " if(activationType == 1) {\n" " out=out>0 ? out : 0;\n" " }\n" " WI_DATA(output,pos,CONVERT_OUTPUT_I4(out));\n" " }\n" " #else\n" " float4 in0,in1;\n" " if (pos.x= dim.x && pos.y >= dim.y) {\n" " return;\n" " }\n" " WI_DATA(output,pos,CONVERT_OUTPUT_I4(RI_DATA(input,SAMPLER,pos)));\n" "}\n" ; }