ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

Run time's comparison betwwen Tensors' DataType::F32 in NEGEMMLowp.cpp and Tensors' DataType::F32 in NEGEMM.cpp

Open duhuanxianzi opened this issue 9 years ago • 6 comments

Hi, I have some problems about Tensors' DataType for NEGEMMLowp.cpp and NEGEMM.cpp

For neon_gemmlowp_test.cpp Tensor input0; Tensor input1; Tensor output; . . . input0.allocator()->init(TensorInfo(src_shape, 1, DataType::F32)); input1.allocator()->init(TensorInfo(src_shape, 1, DataType::F32)); output.allocator()->init(TensorInfo(src_shape, 1, DataType::F32)); . . . NEGEMMLowp gemm_low8; gemm_low8.configure(&input0, &input1, &output, a_offset, b_offset, output_offset, output_mult_int, shift); . . . gemm_low8.run(); //Test Runtime . . .

For neon_gemm_test.cpp Tensor input0; Tensor input1; Tensor output; . . . input0.allocator()->init(TensorInfo(src_shape, 1, DataType::F32)); input1.allocator()->init(TensorInfo(src_shape, 1, DataType::F32)); output.allocator()->init(TensorInfo(src_shape, 1, DataType::F32)); . . . NEGEMM gemm; gemm.configure(&input0, &input1, nullptr, &output, 1.0, 0.0); . . . gemm.run(); //Test Runtime . . .

Compared between the runtime of 'gemmlowp.run();' and 'gemm.run();', I found 'gemmlowp.run();' runs faster than 'gemm.run();'.

Why does this problem appear?

duhuanxianzi avatar May 10 '17 09:05 duhuanxianzi

Hi @duhuanxianzi ,

I think the data type used for GEMMLowP is wrong. You should use DataType::U8.

Could you try to re-run your test with this data type?

Thanks

gmiodice avatar May 10 '17 09:05 gmiodice

I had tried DataType::U8 and it had no problem. Can I set DataType::F16 or DataType::F32 for GEMMLowp?

duhuanxianzi avatar May 10 '17 09:05 duhuanxianzi

When I set DataType::F32 for GEMMLowp, it also runs successfully

duhuanxianzi avatar May 10 '17 09:05 duhuanxianzi

Hi,

NEGEMMLowP works just on DataType::U8 https://github.com/ARM-software/ComputeLibrary/blob/master/arm_compute/runtime/NEON/functions/NEGEMMLowp.h#L64.

DataType::F16 is currently not supported on NEON but you can use it with OpenCL on ARM Mali GPUs.

DataType::F32 is supported by NEGEMM. Ii you use DataType::F32 with NEGEMMLowP in debug mode (debug=1) you should get an error.

Hope this can help,

Thanks

gmiodice avatar May 10 '17 09:05 gmiodice

Thanks a lot!

duhuanxianzi avatar May 10 '17 10:05 duhuanxianzi

Closing issue! Reopen if needed!

GeorgeARM avatar May 10 '17 10:05 GeorgeARM