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 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();
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 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();
Testing::PatternID_t getParamID();

@ -102,6 +102,13 @@ namespace Testing
// Number of parameter configurations
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
@ -285,7 +292,7 @@ API of Memory managers used in the test framework
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.

@ -429,7 +429,7 @@ namespace Client
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;
unsigned long offset,i;
@ -443,6 +443,8 @@ namespace Client
if (gen.kind == 0)
{
offset=gen.offset;
paramKind=Testing::kStaticBuffer;
nbEntries = gen.nbInputSamples / gen.dimensions;
const char *patternStart = this->m_patterns + offset;
@ -454,6 +456,7 @@ namespace Client
Testing::param_t* result;
// Output samples is number of parameter line
len=gen.nbOutputSamples * gen.dimensions;
paramKind=Testing::kDynamicBuffer;
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);
bool canExecute=true;
int dataIndex=0;
Testing::ParameterKind paramKind;
// Read test identification (test ID)
m_io->ReadTestIdentification();
@ -147,7 +148,7 @@ a C++ function pointer from the cycle measurements.
if (m_io->hasParam())
{
Testing::PatternID_t paramID=m_io->getParamID();
paramData = m_io->ImportParams(paramID,entries);
paramData = m_io->ImportParams(paramID,entries,paramKind);
dataIndex = 0;
}
@ -230,7 +231,10 @@ a C++ function pointer from the cycle measurements.
}
if (paramData)
{
free(paramData);
if (paramKind == Testing::kDynamicBuffer)
{
free(paramData);
}
paramData = NULL;
}

@ -495,7 +495,7 @@ namespace Client
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;
@ -510,6 +510,7 @@ namespace Client
if (gen.kind == 0)
{
char *result=NULL;
paramKind=Testing::kDynamicBuffer;
FILE *params=fopen(gen.path.c_str(), "r");
if (params==NULL)
@ -539,6 +540,7 @@ namespace Client
{
Testing::param_t* result;
paramKind=Testing::kDynamicBuffer;
// Output samples is number of parameter line
len=gen.nbOutputSamples * gen.dimensions;

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

@ -1,130 +1,130 @@
W
64
// 0.294732
0x3e96e714
// 0.305068
0x3e9c31ec
// 0.086757
0x3db1adc6
// 0.369003
0x3ebcedfb
// -0.119669
0xbdf51534
// -0.399264
0xbecc6c55
// 0.061593
0x3d7c4952
// 0.110992
0x3de34fe0
// -0.285496
0xbe922c7e
// 0.649563
0x3f2649bf
// 0.097598
0x3dc7e187
// -0.079640
0xbda31a2f
// -0.474077
0xbef2ba3f
// -0.081669
0xbda74227
// 0.267932
0x3e892e63
// 0.814420
0x3f507dd8
// -0.580453
0xbf149893
// 0.398885
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
0x3f800000
// -0.056449
0xbd673729
// 0.484592
0x3ef81c82
// -0.007081
0xbbe8065d
// -0.115404
0xbdec5906
// 0.051243
0x3d51e42a
// 0.445107
0x3ee3e514
// 0.084477
0x3dad0216
// -0.037170
0xbd183f8d
// 0.580892
0x3f14b553
// -0.043201
0xbd30f323
// 0.461559
0x3eec5171
// -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
// -0.250496
0xbe8040fd
// 0.901443
0x3f66c4f5
// -0.364598
0xbebaaca7
// -0.411274
0xbed2927a
// -0.811920
0xbf4fd9fe
// 0.313876
0x3ea0b44e
// -0.060231
0xbd76b519
// -0.064893
0xbd84e670
// -0.201103
0xbe4dedd9
// 0.333203
0x3eaa999e
// 0.349408
0x3eb2e5a3

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

@ -1,130 +1,130 @@
W
64
// 0.337838
0x2B3E481A
// 0.335133
0x2AE5A201
// 0.056751
0x07439D1F
// -0.073284
0xF69EA07D
// -0.093873
0xF3FBFA2E
// 0.603471
0x4D3E872B
// -0.398383
0xCD01C551
// -0.044358
0xFA527A8C
// 0.802327
0x66B2A428
// 0.048582
0x0637F129
// 0.433256
0x3774EBBE
// 0.097385
0x0C771F40
// 0.479860
0x3D6C0F64
// 0.241366
0x1EE51515
// 0.527889
0x4391DE66
// 0.116093
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
0x7FFFFFFF
// 0.241327
0x1EE3CBEE
// 0.274723
0x232A1D02
// 0.163226
0x14E49A7E
// 0.458148
0x3AA4994A
// -0.351976
0xD2F27071
// 0.507448
0x40F40B3D
// -0.006613
0xFF274C36
// -0.175333
0xE98EB0D7
// 0.255245
0x20ABE188
// -0.504271
0xBF740B5C
// 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
// 0.378356
0x306DFC29
// 0.194670
0x18EAEE35
// 0.414865
0x351A4C1D
// -0.581486
0xB591DED5
// 0.030270
0x03DFE433
// 0.404608
0x33CA3439
// -0.020600
0xFD5CF95F
// 0.332379
0x2A8B62B6
// 0.865464
0x6EC782C7
// -0.036174
0xFB5EA345

@ -48,15 +48,33 @@
break;
case TEST_BIQUAD_CASCADE_DF2T_F32_2:
samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
output.create(this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr);
coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5);
state.create(2*this->numStages,BIQUADF32::STATE_F32_ID,mgr);
samples.reload(BIQUADF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
output.create(this->nbSamples,BIQUADF32::OUT_SAMPLES_F32_ID,mgr);
coefs.reload(BIQUADF32::COEFS1_F32_ID,mgr,this->numStages * 5);
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,
coefs.ptr(),
state.ptr());
#endif
break;
case TEST_BIQUAD_CASCADE_STEREO_DF2T_F32_3:

@ -27,13 +27,15 @@
samples.reload(DECIMF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
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);
switch(id)
{
case TEST_FIR_DECIMATE_F32_1:
this->decimationFactor = *it;
state.create(this->nbSamples + this->nbTaps - 1,DECIMF32::STATE_F32_ID,mgr);
arm_fir_decimate_init_f32(&instDecim,
this->nbTaps,
this->decimationFactor,
@ -44,13 +46,19 @@
case TEST_FIR_INTERPOLATE_F32_2:
{
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,
this->interpolationFactor,
this->nbTaps,
coefs.ptr(),
state.ptr(),
this->nbSamples);
}
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):
colsToKeep=[]
cols = list(full.columns)
params = list(joinit(elem.params.full,","))
params = list(elem.params.full)
common = diff(cols + ["TYPE"] , ['OLDID'] + params)
for field in common:
@ -75,8 +75,8 @@ def createTableIfMissing(conn,elem,tableName,full):
if not tableExists(conn,tableName):
sql = "CREATE TABLE %s (" % tableName
cols = list(full.columns)
params = list(joinit(elem.params.full,","))
common = diff(cols + ["TYPE"] , ['OLDID'] + params)
params = list(elem.params.full)
common = diff(cols + ["TYPE"] , ['OLDID'] + params)
sql += "%sid INTEGER PRIMARY KEY" % (tableName)
start = ","
@ -104,7 +104,6 @@ def createTableIfMissing(conn,elem,tableName,full):
sql += "FOREIGN KEY(coreid) REFERENCES CORE(coreid),"
sql += "FOREIGN KEY(compilerid) REFERENCES COMPILER(compilerid)"
sql += " )"
#print(sql)
conn.execute(sql)
# 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
keep = getColumns(elem,full)
cols = list(full.columns)
params = list(joinit(elem.params.full,","))
params = list(elem.params.full)
common = diff(["TYPE"] + cols , ['OLDID'] + params)
colNameList = []
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 STATE_F32_ID : State
Output NEON_COEFS_F32_ID : NeonCoefs
Params PARAM1_ID = {
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 = re.sub(r':','*',f)
#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

Loading…
Cancel
Save