A convert Error caused by the pooling layer
Output of 'strings libarm_compute.so | grep arm_compute_version': arm_compute_version=v18.11 Build options: {'pmu': '1', 'gles_compute': '1', 'benchmark': '1', 'opencl': '1', 'neon': '1', 'example': '1', 'validation_tests': '1', 'so': 'linux', 'build': 'native', 'mali': '1', 'debug': '0', 'arch': 'arm64-v8a', 'Werror': '1'} Git hash=b9abeae0897bef74553ba9800c4ff5f74131c5b4
Platform: arch arm64-v8a and Mali T860
Operating System: Ubuntu 16.04
Problem description: When I running the graph on GPU like this:
graph << ... ;
SubStream conv2_branch1(graph);
conv2_branch1 << ScaleLayer(
get_weights_accessor(data_path, "/cnn_data/xx_w.npy"), // mul weight
get_weights_accessor(data_path, "/cnn_data/xx_b.npy") // add weight
).set_name("conv2_neg");
SubStream conv2_branch2(graph);
graph << ConcatLayer(std::move(conv2_branch1), std::move(conv2_branch2)).set_name("conv2_concat")
<< ScaleLayer(
get_weights_accessor(data_path, "/cnn_data/xx_w.npy"), // mul weight
get_weights_accessor(data_path, "/cnn_data/xx_b.npy") // add weight
).set_name("conv2_scale")
<< ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("conv2_relu")
<< PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))).set_name("Pool2");
I got the following Errors:
Threads : 1
Target : CL
Data type : F32
Data layout : NHWC
Tuner enabled? : false
Tuner file :
Fast math enabled? : false
<source>:427:72: error: can't convert between vector values of different size ('uint4' (vector of 4 'uint' values) and 'long')
const VEC_DATA_TYPE(COND_DATA_TYPE, 4) cond0 = CONVERT((xc_clamped < SRC_WIDTH), VEC_DATA_TYPE(COND_DATA_TYPE, 4));
~~~~~~~~~~ ^ ~~~~~~~~~
<source>:85:38: note: expanded from here
#define CONVERT(x, type) CONVERT_STR(x, type)
^
<source>:84:47: note: expanded from here
#define CONVERT_STR(x, type) (convert_##type((x)))
^
<source>:443:33: error: can't convert between vector values of different size ('uint4' (vector of 4 'uint' values) and 'long')
const uint4 yo = xc_clamped + yc * CONVOLVED_WIDTH; // Index of the convolution
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~
<source>:559:27: warning: comparison of constant 4294967294 with expression of type 'int' is always false
if(x < 0 || x >= SRC_WIDTH || y < 0 || y >= SRC_HEIGHT)
~ ^ ~~~~~~~~~
<source>:559:54: warning: comparison of constant 4294967294 with expression of type 'int' is always false
if(x < 0 || x >= SRC_WIDTH || y < 0 || y >= SRC_HEIGHT)
~ ^ ~~~~~~~~~~
<source>:663:86: warning: comparison of constant 4294967294 with expression of type 'int' is always true
cond0 = CONVERT((x >= (int3)0 && x < (int3)SRC_WIDTH && (int3)(y.s0 >= 0 && y.s0 < SRC_HEIGHT)), VEC_DATA_TYPE(COND_DATA_TYPE, 3));
~~~~ ^ ~~~~~~~~~~
<source>:85:38: note: expanded from here
#define CONVERT(x, type) CONVERT_STR(x, type)
^
<source>:84:47: note: expanded from here
#define CONVERT_STR(x, type) (convert_##type((x)))
^
<source>:665:86: warning: comparison of constant 4294967294 with expression of type 'int' is always true
cond1 = CONVERT((x >= (int3)0 && x < (int3)SRC_WIDTH && (int3)(y.s1 >= 0 && y.s1 < SRC_HEIGHT)), VEC_DATA_TYPE(COND_DATA_TYPE, 3));
~~~~ ^ ~~~~~~~~~~
<source>:85:38: note: expanded from here
#define CONVERT(x, type) CONVERT_STR(x, type)
^
<source>:84:47: note: expanded from here
#define CONVERT_STR(x, type) (convert_##type((x)))
^
<source>:667:86: warning: comparison of constant 4294967294 with expression of type 'int' is always true
cond2 = CONVERT((x >= (int3)0 && x < (int3)SRC_WIDTH && (int3)(y.s2 >= 0 && y.s2 < SRC_HEIGHT)), VEC_DATA_TYPE(COND_DATA_TYPE, 3));
~~~~ ^ ~~~~~~~~~~
<source>:85:38: note: expanded from here
#define CONVERT(x, type) CONVERT_STR(x, type)
^
<source>:84:47: note: expanded from here
#define CONVERT_STR(x, type) (convert_##type((x)))
^
<source>:760:66: warning: comparison of constant 4294967294 with expression of type 'int' is always true
COND_DATA_TYPE x1_condition = (COND_DATA_TYPE)(x1 >= 0 && x1 < SRC_WIDTH);
~~ ^ ~~~~~~~~~
<source>:761:66: warning: comparison of constant 4294967294 with expression of type 'int' is always true
COND_DATA_TYPE y1_condition = (COND_DATA_TYPE)(y1 >= 0 && y1 < SRC_HEIGHT);
~~ ^ ~~~~~~~~~~
error: Compiler frontend failed (error code 59)
terminate called after throwing an instance of 'cl::Error'
what(): clCreateKernel
Aborted (core dumped)
The input size of my graph is:
// Create input descriptor
const TensorShape tensor_shape = permute_shape(TensorShape(160U, 120U, 3U, 1U), DataLayout::NCHW, common_params.data_layout);
TensorDescriptor input_descriptor = TensorDescriptor(tensor_shape, common_params.data_type).set_layout(common_params.data_layout);
How can I fix these errors?
Hi @hiigao
It looks like a problem with your OpenCL implementation. Try casting SRC_WIDTH/HEIGHT to uint4, like this:
CONVERT((xc_clamped < (uint4)SRC_WIDTH), VEC_DATA_TYPE(COND_DATA_TYPE, 4));
This should fix the errors