ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

CLActivationLayer fails after the new updates of the library?

Open jialiang19 opened this issue 9 years ago • 2 comments

Dear ARM Developers:

With the previous version of the library, all my CLActivationLayer worked as expected. However, with the new updates, the first two of my CLActivationLayer worked, but the third one failed.

and the code for the third activation layer is here

        /*relu3*/
        CLTensor activation3;
        const TensorShape activation3_shape(convr3_shape);
        activation3.allocator()->init(TensorInfo(activation3_shape, Format::F32));
        activation3.allocator()->allocate();
        ActivationLayerInfo act_info3(ActivationLayerInfo::ActivationFunction::RELU,0,0);
        CLActivationLayer actlayer3;
        actlayer3.configure(&convr3, &activation3, act_info3);
        actlayer3.run();

and the error message is: arm_issue_155_1

the detailed error message from gdb is: i

I have spent three hours digging into the source code. I later found that the Window returned by

Window                 win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration), border_undefined, border_size);

in the file src/core/CL/ICLSimpleKernel.cpp (line 46) has the win.x().end() = 0;

I try to read the source code, but I have a little trouble to understand. Then I started to twist parameters. I double checked and was confident that the parameters that I provided were corrected, so I started to twist some parameters in the source code.

One thing caught my eye is a hard-coded value in file src/core/CL/kernels/CLActivationLayerKernel.cpp (around line 60)

constexpr unsigned int num_elems_processed_per_iteration = 16;

However, After I changed the value to

constexpr unsigned int num_elems_processed_per_iteration = 8;

Everything starts to work. I do not know why everything starts to work again, but I am sure I must lose some optimization.

Can you explain why the hard-coded value of num_elems_processed_per_iteration is set to 16?

jialiang19 avatar Jun 29 '17 17:06 jialiang19

Hi, please call the allocator after the configuration function. That is because inside the configuration function, it increases window size in X dimension to handle vector operation (in this algorithm implementation, we used vector size 16). If allocator is called before configuration function, the execution window would be shrunk.

steniu01 avatar Jul 02 '17 20:07 steniu01

Thanks, @steniu01, and I think this should be the source of the problem.

jialiang19 avatar Jul 03 '17 15:07 jialiang19