Re: [tim-janik/beast] TESTS: testresampler: fix resampler tests for clang9 (#140)



As additional information, g++-8 also generates different code if you use -mfma.

$ out/tests/suite1 --resampler accuracy --fpu --precision=24 --subsample --freq-scan=90,9000,983 --freq-scan-verbose --verbose

############## g++ 8.3.0 without fma

# accuracy test for factor 2 subsampling using FPU instructions
#   input frequency range used [ 90.00 Hz, 9000.00 Hz ] (SR = 44100.0 Hz, freq increment = 983.00)
90.00000000000000000 -129.40792803150048940
1073.00000000000000000 -130.14152510098830362
2056.00000000000000000 -131.64395956575623359
3039.00000000000000000 -131.48377752074048885
4022.00000000000000000 -127.52623479658792860
5005.00000000000000000 -131.74602243860934436
5988.00000000000000000 -131.71784952867952256
6971.00000000000000000 -133.09696883539237433
7954.00000000000000000 -131.53986659892970579
8937.00000000000000000 -131.78909542900839824
#   max difference between correct and computed output: 0.000000 = -127.526235 dB

############## g++ 8.3.0 with fma

# accuracy test for factor 2 subsampling using FPU instructions
#   input frequency range used [ 90.00 Hz, 9000.00 Hz ] (SR = 44100.0 Hz, freq increment = 983.00)
90.00000000000000000 -129.82104550124302023
1073.00000000000000000 -131.03707434810391419
2056.00000000000000000 -132.40996614732904391
3039.00000000000000000 -133.12443453736065635
4022.00000000000000000 -129.32954166513573568
5005.00000000000000000 -131.90536134591866357
5988.00000000000000000 -130.93045250711062977
6971.00000000000000000 -132.01135805265508338
7954.00000000000000000 -132.97021680274394839
8937.00000000000000000 -133.11067142912733630
#   max difference between correct and computed output: 0.000000 = -129.329542 dB

So (unlike clang9), the fma version provides slightly more accurate results for our 4022 Hz sine wave.

My mental model is this: we start from the error the filter gives us under perfect conditions (infinite precision coefficients and arithmetic). Then we add some random error (with some distribution) that depends on the type and order of the instructions generated by the compiler, due to finite precision. From everything I saw, both clang9 and g++ 8.3.0 provide valid translations with and without -mfma.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]