From 08385a3112e3ab85ae305db46ff0befb94234e07 Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Fri, 9 Aug 2019 15:07:32 +0200 Subject: [PATCH] CMSIS-DSP: Improved benchmarking code. --- .../Benchmarks/BasicMathsBenchmarksF32.cpp | 71 +++++-------------- 1 file changed, 19 insertions(+), 52 deletions(-) diff --git a/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp b/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp index 71cdc23e..e511288f 100644 --- a/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp +++ b/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp @@ -4,95 +4,46 @@ void BasicMathsBenchmarksF32::vec_mult_f32() { - arm_mult_f32(this->inp1,this->inp2,this->outp,this->nb); - } void BasicMathsBenchmarksF32::vec_add_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *inp2=input2.ptr(); - float32_t *outp=output.ptr(); - - arm_add_f32(inp1,inp2,outp,this->nb); - } void BasicMathsBenchmarksF32::vec_sub_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *inp2=input2.ptr(); - float32_t *outp=output.ptr(); - - arm_sub_f32(inp1,inp2,outp,this->nb); - } void BasicMathsBenchmarksF32::vec_abs_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *inp2=input2.ptr(); - float32_t *outp=output.ptr(); - - arm_abs_f32(inp1,outp,this->nb); - } void BasicMathsBenchmarksF32::vec_negate_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *outp=output.ptr(); - - arm_negate_f32(inp1,outp,this->nb); - } void BasicMathsBenchmarksF32::vec_offset_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *inp2=input2.ptr(); - float32_t *outp=output.ptr(); - - arm_offset_f32(inp1,1.0,outp,this->nb); - } - void BasicMathsBenchmarksF32::vec_scale_f32() + void BasicMathsBenchmarksF32::vec_scale_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *inp2=input2.ptr(); - float32_t *outp=output.ptr(); - - - arm_scale_f32(inp1,1.0,outp,this->nb); - + arm_scale_f32(inp1,1.0,outp,this->nb); } void BasicMathsBenchmarksF32::vec_dot_f32() { - - float32_t *inp1=input1.ptr(); - float32_t *inp2=input2.ptr(); float32_t result; - - arm_dot_prod_f32(inp1,inp2,this->nb,&result); - + arm_dot_prod_f32(inp1,inp2,this->nb,&result); } - void BasicMathsBenchmarksF32::setUp(Testing::testID_t id,std::vector& params,Client::PatternMgr *mgr) { @@ -110,6 +61,12 @@ switch(id) { case BasicMathsBenchmarksF32::VEC_MULT_F32_1: + case BasicMathsBenchmarksF32::VEC_ADD_F32_2: + case BasicMathsBenchmarksF32::VEC_SUB_F32_3: + case BasicMathsBenchmarksF32::VEC_ABS_F32_4: + case BasicMathsBenchmarksF32::VEC_OFFSET_F32_6: + case BasicMathsBenchmarksF32::VEC_SCALE_F32_7: + /* This an overhead doing this because ptr() function is doing lot of checks to ensure patterns are fresh. So for small benchmark lengths it is better doing it in the setUp function @@ -118,6 +75,16 @@ this->inp2=input2.ptr(); this->outp=output.ptr(); break; + + case BasicMathsBenchmarksF32::VEC_NEGATE_F32_5: + this->inp1=input1.ptr(); + this->outp=output.ptr(); + break; + + case BasicMathsBenchmarksF32::VEC_DOT_F32_8: + this->inp1=input1.ptr(); + this->inp2=input2.ptr(); + break; } }