Skip to content

Commit

Permalink
notes on the compiler warnings and errors which were fixed (see previ…
Browse files Browse the repository at this point in the history
…ous merges) and to be fixed (see test/mrWolf/readme.md)
  • Loading branch information
xiaywang committed Jan 7, 2022
1 parent 5b97e91 commit 8d772d4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 24 deletions.
4 changes: 2 additions & 2 deletions test/mrWolf/conv/test_lib/testset.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ from pulp_dsp_test import generate_test
function_name = 'plp_conv'

variables = [
SweepVariable('len_a', [127, 128, 129, 130]),
SweepVariable('len_b', [64, 65, 66, 67]),
SweepVariable('len_a', [128, 512]),
SweepVariable('len_b', [128, 512, 1024]),
DynamicVariable('len_y', lambda env: env['len_a'] + env['len_b'] - 1, visible=False),
SweepVariable('fracBits', [1, 5], active=lambda v: 'q' in v),
]
Expand Down
12 changes: 6 additions & 6 deletions test/mrWolf/dot_prod/test_lib/testset.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ from pulp_dsp_test import generate_test
function_name = 'plp_dot_prod'

variables = [
SweepVariable('len', [2, 3, 127, 128, 129, 130, 258, 515]),
SweepVariable('deciPoint', [4, 5, 6], active=lambda v: 'q' in v)
SweepVariable('len', [128, 512, 768, 1024]),
SweepVariable('deciPoint', [4], active=lambda v: 'q' in v)
]

arguments = [
Expand All @@ -85,11 +85,11 @@ implemented = {
'q8': True,
'f32': True,
'i32_parallel': True,
'i16_parallel': False,
'i8_parallel': False,
'i16_parallel': True,
'i8_parallel': True,
'q32_parallel': True,
'q16_parallel': False,
'q8_parallel': False,
'q16_parallel': True,
'q8_parallel': True,
'f32_parallel': True
},
'ibex': {
Expand Down
43 changes: 43 additions & 0 deletions test/mrWolf/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Notes on some of the functions tests:

- Regarding cmplx_mag:

q16 and i16 do not always work.

Likely fails due to imprecision or overflow.

Further investigation:

The tolerance was previously set to 5%, however ultimately the fixpoint argument makes this quite challenging. The nature of the cmplx_mag equation is that you need to protect it from overflows, while also ensuring numbers are large enough that the magnitude is not reduced to nothing. Examples for 16-bit would be with the fixpoint argument being 0 (i.e. normal integers) inputs need to be smaller than 180, as an intermediate result would overflow otherwise, while for a Q1.15 quantization these small numbers are reduced to 0 when squared.

Implemented a newer test based on the unit circle, i.e. the elements checked for a certain fixpoint argument are all along a circle in the complex plane, which has a more or less reasonable magnitude for the tested fixpoint. The coverage of this type of test is definitely somewhat reduced, however the expected error margin can be more tightly controlled, thus allowing tests to pass. Added a note to the documentation regarding this test and regarding what to pay attention to when using this function.

Pull request merged on 3 Aug 2021

- Regarding sin:

q32 fails.

Likely due to the compiler: the code is more or less identical to cos (which works) and sin q32 works for -O0, but fails for -O3

- Regarding power

riscy:plp_power_q8 and power:riscy:plp_power_i8 and power:riscy:plp_power_q16 fail

Fixed i8, q8 and q16 are "supposed to be failing"" as this is an issue with rounding before adding versus rounding after adding -- the differences are minor and the functions are useable but I??d rather not touch the ground truth

- Regarding fft functions (TODO for people who added the functions)

NOTE: only supports data that has length which is a power of 2 since the function only uses the radix2 algorithm. Zero padding can be used for other lengths.

rfft
Test framework outdated, please update to the new version. (Error: ImportError: cannot import name 'ExternalPointedArgument')
Warning: initialization discards 'const' qualifier from pointer target type for f32_parallel.
Warning: passing argument 2 of 'rt_team_fork' from incompatible pointer type .

Possible improvement: real valued FFTs only need the first N/2 complex values to represent the FFT because of symmetry (to be verified).

cfft
Test not implemented
Warning: initialization discards 'const' qualifier from pointer target type for q16 and f32 _parallel.

29 changes: 13 additions & 16 deletions test/mrWolf/testset.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ c['testsets'] = []

# add new test folders here:
# add_test_folder(c, 'test_template') #example on how to do it
#add_test_folder(c, 'conv')
# add_test_folder(c, 'correlate') # NEEDS FIXING, DOES NOT WORK!!!
#add_test_folder(c, 'conv_valid')
#add_test_folder(c, 'conv_valid_rep')
#add_test_folder(c, 'dot_prod')
#add_test_folder(c, 'mat_mul')
add_test_folder(c, 'conv')
# add_test_folder(c, 'correlate')
# add_test_folder(c, 'conv_valid')
# add_test_folder(c, 'conv_valid_rep')
# add_test_folder(c, 'dot_prod')
# add_test_folder(c, 'mat_mul')
# add_test_folder(c, 'mat_mul_cmplx')
# add_test_folder(c, 'mat_mul_trans')
# add_test_folder(c, 'mat_mul_trans_cmplx')
Expand All @@ -44,27 +44,24 @@ c['testsets'] = []
# add_test_folder(c, 'mean')
# add_test_folder(c, 'var')
# add_test_folder(c, 'std')
# add_test_folder(c, 'rms')
# #add_test_folder(c, 'entropy')
# add_test_folder(c, 'cos')
# #add_test_folder(c, 'sin') # NEEDS FIXING, q32 does not work!!!
# add_test_folder(c, 'sin')
# add_test_folder(c, 'sqrt')
# #add_test_folder(c, 'kl')
# #add_test_folder(c, 'rms')
# #add_test_folder(c, 'rfft') # UPDATE TO NEW TEST FRAMEWORK
# #add_test_folder(c, 'cfft')
# #add_test_folder(c, 'cmplx_mag') # NEEDS FIXING, DOES NOT WORK!!!
# add_test_folder(c, 'rms')
# #add_test_folder(c, 'rfft') # TODO: UPDATE TO NEW TEST FRAMEWORK Warning: initialization discards 'const' qualifier from pointer target type for f32_parallel. Warning: passing argument 2 of 'rt_team_fork' from incompatible pointer type . Error: ImportError: cannot import name 'ExternalPointedArgument' it does not exist and is not used anywhere else.
# #add_test_folder(c, 'cfft') # TODO: Warning: initialization discards 'const' qualifier from pointer target type for q16 and f32 _parallel. TODO: the test is not implemented yet!
# add_test_folder(c, 'cmplx_mag')
# add_test_folder(c, 'cmplx_conj')
# add_test_folder(c, 'cmplx_dot_prod')
# add_test_folder(c, 'cmplx_mult_real')
# add_test_folder(c, 'cmplx_mult_cmplx')
# add_test_folder(c, 'cmplx_mag_squared')
# add_test_folder(c, 'cmplx_mag') # NEEDS FIXING, q16 and i16 do not always work!!!
# add_test_folder(c, 'cmplx_mag')
# add_test_folder(c, 'abs')
# add_test_folder(c, 'add')
# add_test_folder(c, 'mult')
# add_test_folder(c, 'negate')
# add_test_folder(c, 'offset')
# add_test_folder(c, 'sub')
add_test_folder(c, 'scale')
# add_test_folder(c, 'scale')

0 comments on commit 8d772d4

Please sign in to comment.