CMSIS-DSP:Test framework improvements and bug corrections

Corrected memory issue in IORunner when using static buffer of
parameters.
Added script to generate a db of regression
Added max regression coef to summary results.
pull/19/head
Christophe Favergeon 6 years ago
parent 628cb2c9eb
commit a794b05eb6

@ -67,7 +67,7 @@ FPGA driver. Used to read a C array describing how to drive the test.
void ImportPattern_u8(Testing::PatternID_t,char*,Testing::nbSamples_t nb); void ImportPattern_u8(Testing::PatternID_t,char*,Testing::nbSamples_t nb);
void DumpParams(std::vector<Testing::param_t>&); void DumpParams(std::vector<Testing::param_t>&);
Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &); Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &,Testing::ParameterKind &);
bool hasParam(); bool hasParam();
Testing::PatternID_t getParamID(); Testing::PatternID_t getParamID();

@ -71,7 +71,7 @@ Semihosting driver. Used to read a text file describing how to drive the test.
void ImportPattern_u8(Testing::PatternID_t,char*,Testing::nbSamples_t nb=0); void ImportPattern_u8(Testing::PatternID_t,char*,Testing::nbSamples_t nb=0);
void DumpParams(std::vector<Testing::param_t>&); void DumpParams(std::vector<Testing::param_t>&);
Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &); Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &,Testing::ParameterKind &);
bool hasParam(); bool hasParam();
Testing::PatternID_t getParamID(); Testing::PatternID_t getParamID();

@ -102,6 +102,13 @@ namespace Testing
// Number of parameter configurations // Number of parameter configurations
typedef unsigned long nbParameterEntries_t; typedef unsigned long nbParameterEntries_t;
// To know if parameter array is malloc buffer or static buffer in C array
enum ParameterKind
{
kStaticBuffer=0,
kDynamicBuffer=1,
};
} }
namespace Client namespace Client
@ -285,7 +292,7 @@ API of Memory managers used in the test framework
They receive parameters as a vector argument for the setUp fucntion. They receive parameters as a vector argument for the setUp fucntion.
*/ */
virtual Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &)=0; virtual Testing::param_t* ImportParams(Testing::PatternID_t,Testing::nbParameterEntries_t &,Testing::ParameterKind &)=0;
/** Dump pattern. /** Dump pattern.

@ -429,7 +429,7 @@ namespace Client
printf("\n"); printf("\n");
} }
Testing::param_t* FPGA::ImportParams(Testing::PatternID_t id,Testing::nbParameterEntries_t &nbEntries) Testing::param_t* FPGA::ImportParams(Testing::PatternID_t id,Testing::nbParameterEntries_t &nbEntries,Testing::ParameterKind &paramKind)
{ {
nbEntries=0; nbEntries=0;
unsigned long offset,i; unsigned long offset,i;
@ -443,6 +443,8 @@ namespace Client
if (gen.kind == 0) if (gen.kind == 0)
{ {
offset=gen.offset; offset=gen.offset;
paramKind=Testing::kStaticBuffer;
nbEntries = gen.nbInputSamples / gen.dimensions; nbEntries = gen.nbInputSamples / gen.dimensions;
const char *patternStart = this->m_patterns + offset; const char *patternStart = this->m_patterns + offset;
@ -454,6 +456,7 @@ namespace Client
Testing::param_t* result; Testing::param_t* result;
// Output samples is number of parameter line // Output samples is number of parameter line
len=gen.nbOutputSamples * gen.dimensions; len=gen.nbOutputSamples * gen.dimensions;
paramKind=Testing::kDynamicBuffer;
result=(Testing::param_t*)malloc(len*sizeof(Testing::param_t)); result=(Testing::param_t*)malloc(len*sizeof(Testing::param_t));

@ -139,6 +139,7 @@ a C++ function pointer from the cycle measurements.
std::vector<Testing::param_t> params(nbParams); std::vector<Testing::param_t> params(nbParams);
bool canExecute=true; bool canExecute=true;
int dataIndex=0; int dataIndex=0;
Testing::ParameterKind paramKind;
// Read test identification (test ID) // Read test identification (test ID)
m_io->ReadTestIdentification(); m_io->ReadTestIdentification();
@ -147,7 +148,7 @@ a C++ function pointer from the cycle measurements.
if (m_io->hasParam()) if (m_io->hasParam())
{ {
Testing::PatternID_t paramID=m_io->getParamID(); Testing::PatternID_t paramID=m_io->getParamID();
paramData = m_io->ImportParams(paramID,entries); paramData = m_io->ImportParams(paramID,entries,paramKind);
dataIndex = 0; dataIndex = 0;
} }
@ -230,7 +231,10 @@ a C++ function pointer from the cycle measurements.
} }
if (paramData) if (paramData)
{ {
free(paramData); if (paramKind == Testing::kDynamicBuffer)
{
free(paramData);
}
paramData = NULL; paramData = NULL;
} }

@ -495,7 +495,7 @@ namespace Client
printf("\n"); printf("\n");
} }
Testing::param_t* Semihosting::ImportParams(Testing::PatternID_t id,Testing::nbParameterEntries_t &nbEntries) Testing::param_t* Semihosting::ImportParams(Testing::PatternID_t id,Testing::nbParameterEntries_t &nbEntries,Testing::ParameterKind &paramKind)
{ {
nbEntries = 0; nbEntries = 0;
@ -510,6 +510,7 @@ namespace Client
if (gen.kind == 0) if (gen.kind == 0)
{ {
char *result=NULL; char *result=NULL;
paramKind=Testing::kDynamicBuffer;
FILE *params=fopen(gen.path.c_str(), "r"); FILE *params=fopen(gen.path.c_str(), "r");
if (params==NULL) if (params==NULL)
@ -539,6 +540,7 @@ namespace Client
{ {
Testing::param_t* result; Testing::param_t* result;
paramKind=Testing::kDynamicBuffer;
// Output samples is number of parameter line // Output samples is number of parameter line
len=gen.nbOutputSamples * gen.dimensions; len=gen.nbOutputSamples * gen.dimensions;

@ -13,6 +13,7 @@ class BIQUADF32:public Client::Suite
Client::LocalPattern<float32_t> output; Client::LocalPattern<float32_t> output;
Client::LocalPattern<float32_t> state; Client::LocalPattern<float32_t> state;
Client::LocalPattern<float32_t> neonCoefs;
arm_biquad_casd_df1_inst_f32 instBiquadDf1; arm_biquad_casd_df1_inst_f32 instBiquadDf1;
arm_biquad_cascade_df2T_instance_f32 instBiquadDf2T; arm_biquad_cascade_df2T_instance_f32 instBiquadDf2T;

@ -1,130 +1,130 @@
W W
64 64
// 0.294732 // 0.649563
0x3e96e714 0x3f2649bf
// 0.305068 // 0.097598
0x3e9c31ec 0x3dc7e187
// 0.086757 // -0.079640
0x3db1adc6 0xbda31a2f
// 0.369003 // -0.474077
0x3ebcedfb 0xbef2ba3f
// -0.119669 // -0.081669
0xbdf51534 0xbda74227
// -0.399264 // 0.267932
0xbecc6c55 0x3e892e63
// 0.061593 // 0.814420
0x3d7c4952 0x3f507dd8
// 0.110992 // -0.580453
0x3de34fe0 0xbf149893
// -0.285496 // 0.398885
0xbe922c7e 0x3ecc3a9a
// -0.075691
0xbd9b03ee
// 0.325981
0x3ea6e6ec
// 0.304560
0x3e9bef3e
// -0.062305
0xbd7f33e9
// 0.099098
0x3dcaf406
// -0.418274
0xbed627fd
// -0.132193
0xbe075da1
// 0.544181
0x3f0b4f6e
// 0.005892
0x3bc11469
// 0.263290
0x3e86cded
// -0.575829
0xbf136987
// -0.199804
0xbe4c9981
// 0.450453
0x3ee6a1d3
// -0.072525
0xbd94880b
// 0.463500
0x3eed4fe2
// 0.651320
0x3f26bce4
// -0.785352
0xbf490cd1
// -1.105668
0xbf8d8685
// -0.005999
0xbbc492a3
// 0.383187
0x3ec43119
// -0.112807
0xbde70743
// -0.094405
0xbdc15790
// 0.568256
0x3f117942
// 0.234140
0x3e6fc27f
// 0.557404
0x3f0eb203
// 0.118612
0x3df2eaa4
// -0.389347
0xbec75871
// -0.393224
0xbec954a8
// 0.228187
0x3e69a9ba
// -0.176939
0xbe352f8f
// 0.253512
0x3e81cc5d
// 0.168579
0x3e2c9fe5
// -0.029022
0xbcedbec0
// 0.092175
0x3dbcc640
// -0.230969
0xbe6c8304
// 0.515084
0x3f03dc92
// 0.219670
0x3e60f126
// -0.246071
0xbe7bfa18
// -0.145649
0xbe15251b
// 0.413992
0x3ed3f6cd
// 0.160768
0x3e24a054
// -0.202494
0xbe4f5a84
// 0.714254
0x3f36d952
// 1.000000 // 1.000000
0x3f800000 0x3f800000
// -0.056449 // -0.250496
0xbd673729 0xbe8040fd
// 0.484592 // 0.901443
0x3ef81c82 0x3f66c4f5
// -0.007081 // -0.364598
0xbbe8065d 0xbebaaca7
// -0.115404 // -0.411274
0xbdec5906 0xbed2927a
// 0.051243 // -0.811920
0x3d51e42a 0xbf4fd9fe
// 0.445107 // 0.313876
0x3ee3e514 0x3ea0b44e
// 0.084477 // -0.060231
0x3dad0216 0xbd76b519
// -0.037170 // -0.064893
0xbd183f8d 0xbd84e670
// 0.580892 // -0.201103
0x3f14b553 0xbe4dedd9
// -0.043201 // 0.333203
0xbd30f323 0x3eaa999e
// 0.461559 // 0.349408
0x3eec5171 0x3eb2e5a3
// -0.074682
0xbd98f2d2
// -0.028579
0xbcea1ebc
// 0.134832
0x3e0a1181
// 0.022127
0x3cb5435c
// -0.235539
0xbe713138
// -0.158748
0xbe228ef3
// -0.308994
0xbe9e3483
// -0.011049
0xbc350683
// -0.120095
0xbdf5f461
// -0.427968
0xbedb1ea3
// -0.124656
0xbdff4b7a
// 0.056117
0x3d65db47
// 0.074986
0x3d9991ff
// -0.633737
0xbf223c9a
// 0.453152
0x3ee8039a
// -0.152014
0xbe1ba991
// 0.182705
0x3e3b1716
// -0.267525
0xbe88f905
// 0.103138
0x3dd33a02
// -0.194995
0xbe47accd
// 0.639574
0x3f23bb1c
// 0.194753
0x3e476d35
// -0.036318
0xbd14c23e
// -0.269953
0xbe8a373b
// 0.153657
0x3e1d583e
// -0.216456
0xbe5da6bd
// 0.141060
0x3e1071ec
// 0.103226
0x3dd367e9
// -0.004779
0xbb9c9776
// -0.077415
0xbd9e8b8b
// 0.252172
0x3e811cbb
// 0.003819
0x3b7a4bc0
// -0.148504
0xbe18117c
// -0.390512
0xbec7f136
// -0.559452
0xbf0f3837
// -0.163960
0xbe27e537
// -0.142945
0xbe126031
// -0.614152
0xbf1d3916
// -0.296426
0xbe97c535
// 0.454037
0x3ee87784
// -0.012337
0xbc4a21fc
// 0.494083
0x3efcf871
// 0.232309
0x3e6de25d

@ -1,130 +1,130 @@
H H
64 64
// -0.255773 // 0.241055
0xDF43 0x1EDB
// 0.059096 // -0.014639
0x0790 0xFE20
// -0.103634 // 0.313550
0xF2BC 0x2822
// -0.183707 // 0.599121
0xE87C 0x4CB0
// 0.019300 // 0.413966
0x0278 0x34FD
// 0.407040 // -0.426701
0x341A 0xC962
// -0.342210 // 0.469578
0xD432 0x3C1B
// -0.335689 // -0.539162
0xD508 0xBAFD
// 0.063671 // -0.036689
0x0826 0xFB4E
// -0.172740 // 0.313468
0xE9E4 0x2820
// -0.217219 // 0.125990
0xE432 0x1020
// -0.169368 // -0.151933
0xEA52 0xEC8D
// 0.717998 // -0.136097
0x5BE7 0xEE94
// 0.326003 // 0.270558
0x29BA 0x22A2
// 0.214267
0x1B6D
// 0.112738
0x0E6E
// 0.492202
0x3F00
// 0.040656
0x0534
// 0.550637
0x467B
// -0.426367
0xC96D
// 0.000898
0x001D
// -0.535114
0xBB81
// -0.642339
0xADC8
// 1.000000 // 1.000000
0x7FFF 0x7FFF
// -0.059778 // -0.187485
0xF859 0xE800
// 0.441343 // 0.194997
0x387E 0x18F6
// 0.194041 // -0.026221
0x18D6 0xFCA5
// 0.025980 // -0.415383
0x0353 0xCAD5
// 0.206521 // -0.038145
0x1A6F 0xFB1E
// -0.387758 // 0.094108
0xCE5E 0x0C0C
// -0.248954 // -0.332432
0xE022 0xD573
// 0.726524 // -0.522480
0x5CFF 0xBD1F
// 0.043741 // -0.527396
0x0599 0xBC7E
// -0.168825 // 0.108861
0xEA64 0x0DEF
// -0.054779 // 0.254822
0xF8FD 0x209E
// -0.321292 // 0.078591
0xD6E0 0x0A0F
// -0.290947 // -0.238323
0xDAC2 0xE17F
// 0.256307 // -0.372518
0x20CF 0xD051
// 0.476763 // 0.224525
0x3D07 0x1CBD
// -0.361268 // 0.146885
0xD1C2 0x12CD
// -0.322948 // -0.240213
0xD6AA 0xE141
// -0.021756 // 0.010133
0xFD37 0x014C
// -0.026559 // 0.261761
0xFC9A 0x2181
// 0.384753 // -0.713404
0x3140 0xA4AF
// -0.438385 // -0.414405
0xC7E3 0xCAF5
// 0.282340 // -0.864016
0x2424 0x9168
// -0.387216 // 0.017714
0xCE70 0x0244
// 0.292089 // -0.320153
0x2563 0xD705
// -0.064482 // -0.624021
0xF7BF 0xB020
// -0.015871 // 0.036300
0xFDF8 0x04A5
// 0.556604 // -0.056065
0x473F 0xF8D3
// 0.257964 // -0.415114
0x2105 0xCADE
// 0.415631 // 0.405900
0x3533 0x33F5
// -0.333850 // 0.172821
0xD544 0x161F
// -0.191197 // 0.359292
0xE787 0x2DFD
// -0.140413 // -0.541108
0xEE07 0xBABD
// 0.309781 // 0.325498
0x27A7 0x29AA
// 0.035575 // -0.594151
0x048E 0xB3F3
// -0.267529 // 0.154654
0xDDC2 0x13CC
// -0.380216 // -0.075563
0xCF55 0xF654
// -0.381696 // -0.806288
0xCF25 0x98CC
// -0.130219 // 0.071565
0xEF55 0x0929
// -0.100136 // -0.152418
0xF32F 0xEC7E
// 0.125777 // 0.078497
0x1019 0x0A0C
// -0.523123
0xBD0A
// 0.092632
0x0BDB
// -0.722456
0xA387
// 0.253678
0x2079
// -0.468343
0xC40D
// -0.493890
0xC0C8
// -0.400808
0xCCB2
// 0.543687
0x4598
// -0.018046
0xFDB1

@ -1,130 +1,130 @@
W W
64 64
// 0.337838 // 0.802327
0x2B3E481A 0x66B2A428
// 0.335133 // 0.048582
0x2AE5A201 0x0637F129
// 0.056751 // 0.433256
0x07439D1F 0x3774EBBE
// -0.073284 // 0.097385
0xF69EA07D 0x0C771F40
// -0.093873 // 0.479860
0xF3FBFA2E 0x3D6C0F64
// 0.603471 // 0.241366
0x4D3E872B 0x1EE51515
// -0.398383 // 0.527889
0xCD01C551 0x4391DE66
// -0.044358 // 0.116093
0xFA527A8C 0x0EDC2288
// -0.621934
0xB064792D
// -0.309842
0xD85715FA
// -0.171168
0xEA1728C6
// 0.159144
0x145ED7B2
// 0.560983
0x47CE49B7
// 0.090194
0x0B8B7C3D
// 0.322986
0x29579A12
// 0.147559
0x12E3336A
// 0.202091
0x19DE21CA
// -0.178780
0xE91DBF15
// -0.000769
0xFFE6CCD1
// -0.024912
0xFCCFAFD8
// -0.535348
0xBB79BA3F
// 0.235166
0x1E19E84A
// 0.635739
0x515FE297
// 0.363205
0x2E7D836F
// 0.357239
0x2DBA0211
// 0.406864
0x34141FAD
// 0.545942
0x45E16FEA
// 0.201545
0x19CC3A5E
// 0.566024
0x48737993
// 0.801325
0x6691D55B
// 0.373777
0x2FD7EB1A
// -0.819260
0x9722790F
// 0.069856
0x08F10E32
// -0.013704
0xFE3EF689
// -0.156115
0xEC046FCA
// 0.323773
0x2971665A
// -0.668367
0xAA72F1B5
// -1.029560
0x80000000
// -0.542805
0xBA8559F8
// -0.661903
0xAB46C4DA
// 0.328165
0x2A014DCD
// 0.097221
0x0C71BC6A
// -0.606980
0xB24E7948
// 0.512422
0x41970E51
// -0.091632
0xF4456502
// -0.384378
0xCECCB43C
// -0.480994
0xC26EC6A4
// -0.232211
0xE246E9E0
// -0.007015
0xFF1A1F8C
// 0.011177
0x016E3BA7
// 0.191536
0x18844493
// -0.374624
0xD00C539B
// 0.137967
0x11A8E82A
// 1.000000 // 1.000000
0x7FFFFFFF 0x7FFFFFFF
// 0.241327 // 0.378356
0x1EE3CBEE 0x306DFC29
// 0.274723 // 0.194670
0x232A1D02 0x18EAEE35
// 0.163226 // 0.414865
0x14E49A7E 0x351A4C1D
// 0.458148 // -0.581486
0x3AA4994A 0xB591DED5
// -0.351976 // 0.030270
0xD2F27071 0x03DFE433
// 0.507448 // 0.404608
0x40F40B3D 0x33CA3439
// -0.006613 // -0.020600
0xFF274C36 0xFD5CF95F
// -0.175333 // 0.332379
0xE98EB0D7 0x2A8B62B6
// 0.255245 // 0.865464
0x20ABE188 0x6EC782C7
// -0.504271 // -0.036174
0xBF740B5C 0xFB5EA345
// 0.057761
0x0764B6B9
// 0.175544
0x16783708
// -0.065540
0xF79C65F7
// 0.194676
0x18EB20D3
// 0.224152
0x1CB106CD
// -0.414730
0xCAEA1DBC
// -0.491006
0xC126B858
// 0.046846
0x05FF1010
// -0.021793
0xFD35E223
// 0.241999
0x1EF9D164
// 0.569330
0x48DFD064
// 0.524831
0x432DAA9C
// 0.063312
0x081A9B35
// 0.285124
0x247EEE57
// -0.090669
0xF464F328
// 0.001040
0x0022160D
// 0.016204
0x0212F53D
// 0.055975
0x072A2CCA
// -0.596260
0xB3ADC2C1
// -0.695282
0xA700FD96
// 0.469239
0x3C1003CB
// -0.396653
0xCD3A7A51
// -0.389939
0xCE167C8D
// 0.644271
0x52777846
// 0.054173
0x06EF20D6
// -0.295808
0xDA22F428
// -0.428808
0xC91CD50A
// -0.410231
0xCB7D8C68
// -0.025915
0xFCAED434
// 0.146305
0x12BA22AD
// -0.417631
0xCA8B0E34
// -0.219538
0xE3E62A12
// -0.001634
0xFFCA71F7
// 0.014981
0x01EAE1DC
// -0.365560
0xD135526C
// 0.269063
0x2270A6BB
// -0.172023
0xE9FB2768
// 0.609680
0x4E0A016D
// 0.183518
0x177D82B6
// -0.053841
0xF91BBB17
// 0.097171
0x0C701940
// -0.307550
0xD8A23471
// -0.137495
0xEE6692D1
// -0.047563
0xF9E9761A
// 0.072156
0x093C645F

@ -48,15 +48,33 @@
break; break;
case TEST_BIQUAD_CASCADE_DF2T_F32_2: case TEST_BIQUAD_CASCADE_DF2T_F32_2:
samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,this->nbSamples); samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
output.create(this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr); output.create(this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr);
coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5); coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5);
state.create(2*this->numStages,BIQUADF32::STATE_F32_ID,mgr); state.create(2*this->numStages,BIQUADF32::STATE_F32_ID,mgr);
#if defined(ARM_MATH_NEON)
// For Neon, neonCoefs is the coef array and is bigger
neonCoefs.create(8*this->numStages,BIQUADF32::STATE_F32_ID,mgr);
arm_biquad_cascade_df2T_init_f32(&instBiquadDf2T, arm_biquad_cascade_df2T_init_f32(&instBiquadDf2T,
this->numStages,
neonCoefs.ptr(),
state.ptr());
// Those Neon coefs must be computed from original coefs
arm_biquad_cascade_df2T_compute_coefs_f32(&instBiquadDf2T,this->numStages,coefs.ptr());
#else
// For cortex-M, coefs is the coef array
arm_biquad_cascade_df2T_init_f32(&instBiquadDf2T,
this->numStages, this->numStages,
coefs.ptr(), coefs.ptr(),
state.ptr()); state.ptr());
#endif
break; break;
case TEST_BIQUAD_CASCADE_STEREO_DF2T_F32_3: case TEST_BIQUAD_CASCADE_STEREO_DF2T_F32_3:

@ -27,13 +27,15 @@
samples.reload(DECIMF32::SAMPLES1_F32_ID,mgr,this->nbSamples); samples.reload(DECIMF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
coefs.reload(DECIMF32::COEFS1_F32_ID,mgr,this->nbTaps); coefs.reload(DECIMF32::COEFS1_F32_ID,mgr,this->nbTaps);
state.create(this->nbSamples + this->nbTaps - 1,DECIMF32::STATE_F32_ID,mgr);
output.create(this->nbSamples,DECIMF32::OUT_SAMPLES_F32_ID,mgr); output.create(this->nbSamples,DECIMF32::OUT_SAMPLES_F32_ID,mgr);
switch(id) switch(id)
{ {
case TEST_FIR_DECIMATE_F32_1: case TEST_FIR_DECIMATE_F32_1:
this->decimationFactor = *it; this->decimationFactor = *it;
state.create(this->nbSamples + this->nbTaps - 1,DECIMF32::STATE_F32_ID,mgr);
arm_fir_decimate_init_f32(&instDecim, arm_fir_decimate_init_f32(&instDecim,
this->nbTaps, this->nbTaps,
this->decimationFactor, this->decimationFactor,
@ -44,13 +46,19 @@
case TEST_FIR_INTERPOLATE_F32_2: case TEST_FIR_INTERPOLATE_F32_2:
{
this->interpolationFactor = *it; this->interpolationFactor = *it;
int phase = this->nbTaps / this->interpolationFactor;
state.create(this->nbSamples + phase - 1,DECIMF32::STATE_F32_ID,mgr);
arm_fir_interpolate_init_f32(&instInterpol, arm_fir_interpolate_init_f32(&instInterpol,
this->interpolationFactor, this->interpolationFactor,
this->nbTaps, this->nbTaps,
coefs.ptr(), coefs.ptr(),
state.ptr(), state.ptr(),
this->nbSamples); this->nbSamples);
}
break; break;

@ -0,0 +1,24 @@
echo "Basic Maths"
python addToDB.py -f bench.txt BasicBenchmarks
echo "Complex Maths"
python addToDB.py -f bench.txt ComplexBenchmarks
echo "FIR"
python addToDB.py -f bench.txt FIR
echo "Convolution / Correlation"
python addToDB.py -f bench.txt MISC
echo "Decimation / Interpolation"
python addToDB.py -f bench.txt DECIM
echo "BiQuad"
python addToDB.py -f bench.txt BIQUAD
echo "Controller"
python addToDB.py -f bench.txt Controller
echo "Fast Math"
python addToDB.py -f bench.txt FastMath
echo "Barycenter"
python addToDB.py -f bench.txt SupportBarF32
echo "Support"
python addToDB.py -f bench.txt Support
echo "Unary Matrix"
python addToDB.py -f bench.txt Unary
echo "Binary Matrix"
python addToDB.py -f bench.txt Binary

@ -0,0 +1,24 @@
echo "Basic Maths"
python addToRegDB.py -f bench.txt BasicBenchmarks
echo "Complex Maths"
python addToRegDB.py -f bench.txt ComplexBenchmarks
echo "FIR"
python addToRegDB.py -f bench.txt FIR
echo "Convolution / Correlation"
python addToRegDB.py -f bench.txt MISC
echo "Decimation / Interpolation"
python addToRegDB.py -f bench.txt DECIM
echo "BiQuad"
python addToRegDB.py -f bench.txt BIQUAD
echo "Controller"
python addToRegDB.py -f bench.txt Controller
echo "Fast Math"
python addToRegDB.py -f bench.txt FastMath
echo "Barycenter"
python addToRegDB.py -f bench.txt SupportBarF32
echo "Support"
python addToRegDB.py -f bench.txt Support
echo "Unary Matrix"
python addToRegDB.py -f bench.txt Unary
echo "Binary Matrix"
python addToRegDB.py -f bench.txt Binary

@ -55,7 +55,7 @@ def diff(first, second):
def getColumns(elem,full): def getColumns(elem,full):
colsToKeep=[] colsToKeep=[]
cols = list(full.columns) cols = list(full.columns)
params = list(joinit(elem.params.full,",")) params = list(elem.params.full)
common = diff(cols + ["TYPE"] , ['OLDID'] + params) common = diff(cols + ["TYPE"] , ['OLDID'] + params)
for field in common: for field in common:
@ -75,8 +75,8 @@ def createTableIfMissing(conn,elem,tableName,full):
if not tableExists(conn,tableName): if not tableExists(conn,tableName):
sql = "CREATE TABLE %s (" % tableName sql = "CREATE TABLE %s (" % tableName
cols = list(full.columns) cols = list(full.columns)
params = list(joinit(elem.params.full,",")) params = list(elem.params.full)
common = diff(cols + ["TYPE"] , ['OLDID'] + params) common = diff(cols + ["TYPE"] , ['OLDID'] + params)
sql += "%sid INTEGER PRIMARY KEY" % (tableName) sql += "%sid INTEGER PRIMARY KEY" % (tableName)
start = "," start = ","
@ -104,7 +104,6 @@ def createTableIfMissing(conn,elem,tableName,full):
sql += "FOREIGN KEY(coreid) REFERENCES CORE(coreid)," sql += "FOREIGN KEY(coreid) REFERENCES CORE(coreid),"
sql += "FOREIGN KEY(compilerid) REFERENCES COMPILER(compilerid)" sql += "FOREIGN KEY(compilerid) REFERENCES COMPILER(compilerid)"
sql += " )" sql += " )"
#print(sql)
conn.execute(sql) conn.execute(sql)
# Find the key or add it in a table # Find the key or add it in a table
@ -148,7 +147,7 @@ def addRows(conn,elem,tableName,full):
# different from the columns in the table # different from the columns in the table
keep = getColumns(elem,full) keep = getColumns(elem,full)
cols = list(full.columns) cols = list(full.columns)
params = list(joinit(elem.params.full,",")) params = list(elem.params.full)
common = diff(["TYPE"] + cols , ['OLDID'] + params) common = diff(["TYPE"] + cols , ['OLDID'] + params)
colNameList = [] colNameList = []
for c in params + keep: for c in params + keep:

@ -0,0 +1,296 @@
# Process the test results
# Test status (like passed, or failed with error code)
import argparse
import re
import TestScripts.NewParser as parse
import TestScripts.CodeGen
from collections import deque
import os.path
import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
import csv
import TestScripts.Deprecate as d
import sqlite3
import datetime, time
import re
# For table creation
MKSTRFIELD=['NAME','Regression']
MKBOOLFIELD=['HARDFP', 'FASTMATH', 'NEON', 'UNROLL', 'ROUNDING','OPTIMIZED']
MKINTFIELD=['ID', 'MAX','MAXREGCOEF']
MKDATEFIELD=['DATE']
MKKEYFIELD=['CATEGORY', 'PLATFORM', 'CORE', 'COMPILER','TYPE']
MKKEYFIELDID={'CATEGORY':'categoryid',
'PLATFORM':'platformid',
'CORE':'coreid',
'COMPILER':'compilerid',
'TYPE':'typeid'}
# For table value extraction
VALSTRFIELD=['NAME','VERSION','Regression']
VALBOOLFIELD=['HARDFP', 'FASTMATH', 'NEON', 'UNROLL', 'ROUNDING','OPTIMIZED']
VALINTFIELD=['ID', 'MAX','MAXREGCOEF']
VALDATEFIELD=['DATE']
VALKEYFIELD=['CATEGORY', 'PLATFORM', 'CORE', 'COMPILER','TYPE']
def joinit(iterable, delimiter):
it = iter(iterable)
yield next(it)
for x in it:
yield delimiter
yield x
def tableExists(c,tableName):
req=(tableName,)
r=c.execute("SELECT name FROM sqlite_master WHERE type='table' AND name=?",req)
return(r.fetchone() != None)
def diff(first, second):
second = set(second)
return [item for item in first if item not in second]
def getColumns(elem,full):
colsToKeep=[]
cols = list(full.columns)
params=diff(elem.params.full , elem.params.summary)
common = diff(cols + ["TYPE"] , ['OLDID'] + params)
for field in common:
if field in MKSTRFIELD:
colsToKeep.append(field)
if field in MKINTFIELD:
colsToKeep.append(field)
if field in MKKEYFIELD:
colsToKeep.append(field)
if field in MKDATEFIELD:
colsToKeep.append(field)
if field in MKBOOLFIELD:
colsToKeep.append(field)
return(colsToKeep)
def createTableIfMissing(conn,elem,tableName,full):
if not tableExists(conn,tableName):
sql = "CREATE TABLE %s (" % tableName
cols = list(full.columns)
params=diff(elem.params.full , elem.params.summary)
common = diff(cols + ["TYPE"] , ['OLDID'] + params)
sql += "%sid INTEGER PRIMARY KEY" % (tableName)
start = ","
for field in params:
sql += " %s\n %s INTEGER" % (start,field)
start = ","
for field in common:
if field in MKSTRFIELD:
sql += "%s\n %s TEXT" % (start,field)
if field in MKINTFIELD:
sql += "%s\n %s INTEGER" % (start,field)
if field in MKKEYFIELD:
sql += "%s\n %s INTEGER" % (start,MKKEYFIELDID[field])
if field in MKDATEFIELD:
sql += "%s\n %s TEXT" % (start,field)
if field in MKBOOLFIELD:
sql += "%s\n %s INTEGER" % (start,field)
start = ","
# Create foreign keys
sql += "%sFOREIGN KEY(typeid) REFERENCES TYPE(typeid)," % start
sql += "FOREIGN KEY(categoryid) REFERENCES CATEGORY(categoryid),"
sql += "FOREIGN KEY(platformid) REFERENCES PLATFORM(platformid),"
sql += "FOREIGN KEY(coreid) REFERENCES CORE(coreid),"
sql += "FOREIGN KEY(compilerid) REFERENCES COMPILER(compilerid)"
sql += " )"
conn.execute(sql)
# Find the key or add it in a table
def findInTable(conn,table,keystr,strv,key):
#print(sql)
r = conn.execute("select %s from %s where %s=?" % (key,table,keystr),(strv,))
result=r.fetchone()
if result != None:
return(result[0])
else:
conn.execute("INSERT INTO %s(%s) VALUES(?)" % (table,keystr),(strv,))
conn.commit()
r = conn.execute("select %s from %s where %s=?" % (key,table,keystr),(strv,))
result=r.fetchone()
if result != None:
#print(result)
return(result[0])
else:
return(None)
def findInCompilerTable(conn,kind,version):
#print(sql)
r = conn.execute("select compilerid from COMPILER where compilerkindid=? AND version=?" , (kind,version))
result=r.fetchone()
if result != None:
return(result[0])
else:
conn.execute("INSERT INTO COMPILER(compilerkindid,version) VALUES(?,?)" ,(kind,version))
conn.commit()
r = conn.execute("select compilerid from COMPILER where compilerkindid=? AND version=?" , (kind,version))
result=r.fetchone()
if result != None:
#print(result)
return(result[0])
else:
return(None)
def addRows(conn,elem,tableName,full):
# List of columns we have in DB which is
# different from the columns in the table
keep = getColumns(elem,full)
cols = list(full.columns)
params=diff(elem.params.full , elem.params.summary)
common = diff(["TYPE"] + cols , ['OLDID'] + params)
colNameList = []
for c in params + keep:
if c in MKKEYFIELD:
colNameList.append(MKKEYFIELDID[c])
else:
colNameList.append(c)
colNames = "".join(joinit(colNameList,","))
#print(colNameList)
#print(colNames)
#print(full)
for index, row in full.iterrows():
sql = "INSERT INTO %s(%s) VALUES(" % (tableName,colNames)
keys = {}
# Get data from columns
for field in common:
if field in VALSTRFIELD:
keys[field]=row[field]
if field == "NAME":
name = row[field]
if re.match(r'^.*_f64',name):
keys["TYPE"] = "f64"
if re.match(r'^.*_f32',name):
keys["TYPE"] = "f32"
if re.match(r'^.*_f16',name):
keys["TYPE"] = "f16"
if re.match(r'^.*_q31',name):
keys["TYPE"] = "q31"
if re.match(r'^.*_q15',name):
keys["TYPE"] = "q15"
if re.match(r'^.*_q7',name):
keys["TYPE"] = "q7"
if re.match(r'^.*_s8',name):
keys["TYPE"] = "s8"
if re.match(r'^.*_u8',name):
keys["TYPE"] = "u8"
if re.match(r'^.*_s16',name):
keys["TYPE"] = "s16"
if re.match(r'^.*_u16',name):
keys["TYPE"] = "u16"
if re.match(r'^.*_s32',name):
keys["TYPE"] = "s32"
if re.match(r'^.*_u32',name):
keys["TYPE"] = "u32"
if re.match(r'^.*_s64',name):
keys["TYPE"] = "s64"
if re.match(r'^.*_u64',name):
keys["TYPE"] = "u64"
if field in VALINTFIELD:
keys[field]=row[field]
if field in VALDATEFIELD:
keys[field]=row[field]
if field in VALBOOLFIELD:
keys[field]=row[field]
# Get foreign keys and create missing data
for field in common:
if field in VALKEYFIELD:
if field == "CATEGORY":
val = findInTable(conn,"CATEGORY","category",row[field],"categoryid")
keys[field]=val
if field == "CORE":
val = findInTable(conn,"CORE","coredef",row[field],"coreid")
keys[field]=val
if field == "PLATFORM":
val = findInTable(conn,"PLATFORM","platform",row[field],"platformid")
keys[field]=val
if field == "TYPE":
val = findInTable(conn,"TYPE","type",keys["TYPE"],"typeid")
keys[field]=val
if field == "COMPILER":
compilerkind = findInTable(conn,"COMPILERKIND","compiler",row[field],"compilerkindid")
compiler = findInCompilerTable(conn,compilerkind,keys["VERSION"])
keys[field]=compiler
# Generate sql command
start = ""
for field in params:
sql += " %s\n %d" % (start,row[field])
start = ","
for field in keep:
if field in MKSTRFIELD or field in MKDATEFIELD:
sql += " %s\n \"%s\"" % (start,keys[field])
elif field in keep:
sql += " %s\n %d" % (start,keys[field])
start = ","
sql += " )"
#print(sql)
conn.execute(sql)
conn.commit()
def addOneBenchmark(elem,fullPath,db,group):
full=pd.read_csv(fullPath,dtype={'OLDID': str} ,keep_default_na = False)
full['DATE'] = datetime.datetime.now()
if group:
tableName = group
else:
tableName = elem.data["class"]
conn = sqlite3.connect(db)
createTableIfMissing(conn,elem,tableName,full)
addRows(conn,elem,tableName,full)
conn.close()
def addToDB(benchmark,dbpath,elem,group):
if not elem.data["deprecated"]:
if elem.params:
benchPath = os.path.join(benchmark,elem.fullPath(),"regression.csv")
print("Processing %s" % benchPath)
addOneBenchmark(elem,benchPath,dbpath,group)
for c in elem.children:
addToDB(benchmark,dbpath,c,group)
parser = argparse.ArgumentParser(description='Generate summary benchmarks')
parser.add_argument('-f', nargs='?',type = str, default=None, help="Test description file path")
parser.add_argument('-b', nargs='?',type = str, default="FullBenchmark", help="Full Benchmark dir path")
#parser.add_argument('-e', action='store_true', help="Embedded test")
parser.add_argument('-o', nargs='?',type = str, default="reg.db", help="Regression benchmark database")
parser.add_argument('others', nargs=argparse.REMAINDER)
args = parser.parse_args()
if args.f is not None:
p = parse.Parser()
# Parse the test description file
root = p.parse(args.f)
d.deprecate(root,args.others)
if args.others:
group=args.others[0]
else:
group=None
addToDB(args.b,args.o,root,group)
else:
parser.print_help()

@ -690,6 +690,7 @@ group Root {
Output OUT_SAMPLES_F32_ID : Output Output OUT_SAMPLES_F32_ID : Output
Output STATE_F32_ID : State Output STATE_F32_ID : State
Output NEON_COEFS_F32_ID : NeonCoefs
Params PARAM1_ID = { Params PARAM1_ID = {
NumStages = [1,2,4] NumStages = [1,2,4]

@ -0,0 +1,24 @@
echo "Basic Maths"
python summaryBench.py -f bench.txt BasicBenchmarks
echo "Complex Maths"
python summaryBench.py -f bench.txt ComplexBenchmarks
echo "FIR"
python summaryBench.py -f bench.txt FIR
echo "Convolution / Correlation"
python summaryBench.py -f bench.txt MISC
echo "Decimation / Interpolation"
python summaryBench.py -f bench.txt DECIM
echo "BiQuad"
python summaryBench.py -f bench.txt BIQUAD
echo "Controller"
python summaryBench.py -f bench.txt Controller
echo "Fast Math"
python summaryBench.py -f bench.txt FastMath
echo "Barycenter"
python summaryBench.py -f bench.txt SupportBarF32
echo "Support"
python summaryBench.py -f bench.txt Support
echo "Unary Matrix"
python summaryBench.py -f bench.txt Unary
echo "Binary Matrix"
python summaryBench.py -f bench.txt Binary

@ -80,7 +80,7 @@ def summaryBenchmark(elem,path):
f="".join(f) f="".join(f)
f = re.sub(r':','*',f) f = re.sub(r':','*',f)
#print(results.summary()) #print(results.summary())
return(pd.Series({'Regression':"%s" % f,'MAX' : m})) return(pd.Series({'Regression':"%s" % f,'MAX' : m,'MAXREGCOEF' : results.params.values[-1]}))
regList = ['ID','OLDID','CATEGORY','NAME'] + csvheaders + groupList regList = ['ID','OLDID','CATEGORY','NAME'] + csvheaders + groupList

Loading…
Cancel
Save