ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.03k stars 406 forks source link

Test SynetConvert32fTo8uAutoTest failed #199

Closed elpascal closed 2 years ago

elpascal commented 2 years ago

From commit a4e52f51 : ` [000] Info: SynetConvert32fTo8uAutoTest is started : [000] Info: Test Simd::Base::SynetConvert32fTo8u[2x256x32x43:Nchw-0] & SimdSynetConvert32fTo8u[2x256x32x43:Nchw-0] [000] Info: Test Simd::Base::SynetConvert32fTo8u[1x3x369x375:Nchw-0] & SimdSynetConvert32fTo8u[1x3x369x375:Nchw-0] [000] Info: Test Simd::Base::SynetConvert32fTo8u[2x256x32x43:Nchw-1] & SimdSynetConvert32fTo8u[2x256x32x43:Nchw-1] [000] Info: Test Simd::Base::SynetConvert32fTo8u[1x3x369x375:Nchw-1] & SimdSynetConvert32fTo8u[1x3x369x375:Nchw-1] [000] Info: Test Simd::Base::SynetConvert32fTo8u[2x256x32x43:Nchw-2] & SimdSynetConvert32fTo8u[2x256x32x43:Nchw-2] [000] Error: Fail comparison: Error at [1, 6, 26, 33] : 132 != 133; (difference = 1)!

[000] Error: SynetConvert32fTo8uAutoTest has errors. TEST EXECUTION IS TERMINATED! `

ermig1979 commented 2 years ago

I can't reproduce this bug. Could you give more information about your compiler?

elpascal commented 2 years ago

13:07 $ gcc --version gcc (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc.

ermig1979 commented 2 years ago

Unfortunately the error is not reproduced on my machine. But I localized suspected place. I have another question: Did you use any Simd cmake build options?

elpascal commented 2 years ago

Tried with : gcc (Ubuntu 8.4.0-3ubuntu2) 8.4.0 Copyright (C) 2018 Free Software Foundation, Inc. and gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0 Copyright (C) 2017 Free Software Foundation, Inc. --> The result is the same : error I start compile from ./build (new empy folder before every compile) my command line is (as README.md tells) : cmake ../prj/cmake -DSIMD_TOOLCHAIN="" -DSIMD_TARGET="" cmake version : 3.16.3

elpascal commented 2 years ago

Installed and tested with : gcc (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 Copyright (C) 2020 Free Software Foundation, Inc. --> exactly the same error

elpascal commented 2 years ago

Ah haaaa, got it! when running ./Test with no param --> error (processing all other tests before that one which causes error...) BUT, when running ./Test -fi=SynetConvert32fTo8u, all is well! (success) May be the test isn't really faulty? :thinking:

ermig1979 commented 2 years ago

I reproduced this error. Fix will be tomorrow.

The using of FMA instructions gives performance gain but gives slightly different result (changes mainly the last digit). It is never mind if we use only float point numbers, but if we then perform rounding operation then rarely we can get significant error. Simd supports both (fast and exact) methods. This bug is test error.

elpascal commented 2 years ago

Happy you found it so quick! THX

ermig1979 commented 2 years ago

The bug was fixed.