From 92be16c2aadf8bee5a2c7661b64caf8d8029e495 Mon Sep 17 00:00:00 2001 From: Christophe Favergeon Date: Tue, 12 May 2020 07:23:54 +0200 Subject: [PATCH] CMSIS-DSP: Improved tests --- Testing/Source/Benchmarks/TransformF32.cpp | 2 - Testing/Source/Benchmarks/TransformQ15.cpp | 94 +--------------------- Testing/Source/Benchmarks/TransformQ31.cpp | 92 --------------------- Testing/addToDB.py | 6 +- Testing/addToRegDB.py | 6 +- Testing/bench.txt | 24 +++++- configCore.cmake | 4 + 7 files changed, 36 insertions(+), 192 deletions(-) diff --git a/Testing/Source/Benchmarks/TransformF32.cpp b/Testing/Source/Benchmarks/TransformF32.cpp index 58759c19..53de1c8f 100755 --- a/Testing/Source/Benchmarks/TransformF32.cpp +++ b/Testing/Source/Benchmarks/TransformF32.cpp @@ -1,9 +1,7 @@ #include "TransformF32.h" #include "Error.h" #include "arm_math.h" -#include "arm_const_structs.h" - void TransformF32::test_cfft_f32() { arm_cfft_f32(&(this->cfftInstance), this->pDst, this->ifft,this->bitRev); diff --git a/Testing/Source/Benchmarks/TransformQ15.cpp b/Testing/Source/Benchmarks/TransformQ15.cpp index 6955bc46..f52eb765 100755 --- a/Testing/Source/Benchmarks/TransformQ15.cpp +++ b/Testing/Source/Benchmarks/TransformQ15.cpp @@ -1,98 +1,6 @@ #include "TransformQ15.h" #include "Error.h" -#include "arm_const_structs.h" - -#define CFFT_INIT(typ, suffix, S, fftLen) \ - \ -{ \ - \ - /* Initialise the default arm status */ \ - arm_status status = ARM_MATH_SUCCESS; \ - \ - /* Initialise the FFT length */ \ - S->fftLen = fftLen; \ - \ - /* Initialise the Twiddle coefficient pointer */ \ - S->pTwiddle = (typ *)twiddleCoef_4096_##suffix; \ - \ - \ - /* Initializations of Instance structure depending on the FFT length */\ - switch (S->fftLen) { \ - \ - \ - /* Initializations of structure parameters for 2048 point FFT */ \ - case 2048U: \ - /* Initialise the bit reversal table modifier */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_2048; \ - S->pTwiddle = (typ *)twiddleCoef_2048_##suffix; \ - break; \ - \ - /* Initializations of structure parameters for 1024 point FFT */ \ - case 1024U: \ - /* Initialise the bit reversal table modifier */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_1024; \ - S->pTwiddle = (typ *)twiddleCoef_1024_##suffix; \ - break; \ - \ - /* Initializations of structure parameters for 512 point FFT */ \ - case 512U: \ - /* Initialise the bit reversal table modifier */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_512; \ - S->pTwiddle = (typ *)twiddleCoef_512_##suffix; \ - break; \ - \ - case 256U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_256; \ - S->pTwiddle = (typ *)twiddleCoef_256_##suffix; \ - \ - break; \ - \ - case 128U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_128; \ - S->pTwiddle = (typ *)twiddleCoef_128_##suffix; \ - \ - break; \ - \ - case 64U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_64; \ - S->pTwiddle = (typ *)twiddleCoef_64_##suffix; \ - break; \ - \ - case 32U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_32; \ - S->pTwiddle = (typ *)twiddleCoef_32_##suffix; \ - break; \ - \ - case 16U: \ - /* Initializations of structure parameters for 16 point FFT */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_16; \ - S->pTwiddle = (typ *)twiddleCoef_16_##suffix; \ - break; \ - \ - \ - default: \ - /* Reporting argument error if fftSize is not valid value */ \ - status = ARM_MATH_ARGUMENT_ERROR; \ - break; \ - } \ - \ - \ - return (status); \ - \ -} - -arm_status arm_cfft_init_q15(arm_cfft_instance_q15 *S, uint16_t fftLen) -{ - CFFT_INIT(q15_t, q15, S, fftLen); -} + void TransformQ15::test_cfft_q15() { diff --git a/Testing/Source/Benchmarks/TransformQ31.cpp b/Testing/Source/Benchmarks/TransformQ31.cpp index 34a5e0ea..3e81c803 100755 --- a/Testing/Source/Benchmarks/TransformQ31.cpp +++ b/Testing/Source/Benchmarks/TransformQ31.cpp @@ -1,97 +1,5 @@ #include "TransformQ31.h" #include "Error.h" -#include "arm_const_structs.h" - -#define CFFT_INIT(typ, suffix, S, fftLen) \ - \ -{ \ - \ - /* Initialise the default arm status */ \ - arm_status status = ARM_MATH_SUCCESS; \ - \ - /* Initialise the FFT length */ \ - S->fftLen = fftLen; \ - \ - /* Initialise the Twiddle coefficient pointer */ \ - S->pTwiddle = (typ *)twiddleCoef_4096_##suffix; \ - \ - \ - /* Initializations of Instance structure depending on the FFT length */\ - switch (S->fftLen) { \ - \ - /* Initializations of structure parameters for 2048 point FFT */ \ - case 2048U: \ - /* Initialise the bit reversal table modifier */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_2048; \ - S->pTwiddle = (typ *)twiddleCoef_2048_##suffix; \ - break; \ - \ - /* Initializations of structure parameters for 1024 point FFT */ \ - case 1024U: \ - /* Initialise the bit reversal table modifier */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_1024; \ - S->pTwiddle = (typ *)twiddleCoef_1024_##suffix; \ - break; \ - \ - /* Initializations of structure parameters for 512 point FFT */ \ - case 512U: \ - /* Initialise the bit reversal table modifier */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_512; \ - S->pTwiddle = (typ *)twiddleCoef_512_##suffix; \ - break; \ - \ - case 256U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_256; \ - S->pTwiddle = (typ *)twiddleCoef_256_##suffix; \ - \ - break; \ - \ - case 128U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_128; \ - S->pTwiddle = (typ *)twiddleCoef_128_##suffix; \ - \ - break; \ - \ - case 64U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_64; \ - S->pTwiddle = (typ *)twiddleCoef_64_##suffix; \ - break; \ - \ - case 32U: \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_32; \ - S->pTwiddle = (typ *)twiddleCoef_32_##suffix; \ - break; \ - \ - case 16U: \ - /* Initializations of structure parameters for 16 point FFT */ \ - S->bitRevLength = ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH; \ - S->pBitRevTable = (uint16_t *)armBitRevIndexTable_fixed_16; \ - S->pTwiddle = (typ *)twiddleCoef_16_##suffix; \ - break; \ - \ - \ - default: \ - /* Reporting argument error if fftSize is not valid value */ \ - status = ARM_MATH_ARGUMENT_ERROR; \ - break; \ - } \ - \ - \ - return (status); \ - \ -} - -arm_status arm_cfft_init_q31(arm_cfft_instance_q31 *S, uint16_t fftLen) -{ - CFFT_INIT(q31_t, q31, S, fftLen); -} void TransformQ31::test_cfft_q31() { diff --git a/Testing/addToDB.py b/Testing/addToDB.py index fb72f81a..4d7b6688 100755 --- a/Testing/addToDB.py +++ b/Testing/addToDB.py @@ -215,7 +215,11 @@ def addRows(conn,elem,tableName,full): for field in common: if field in VALKEYFIELD: if field == "CATEGORY": - val = findInTable(conn,"CATEGORY","category",row[field],"categoryid") + # Remove type extension to get category name so that + # all types are maped to same category which will + # help for post processing. + testField=re.sub(r'^(.*)[:]([^:]+)(F16|F32|F64|Q31|Q15|Q7)$',r'\1',row[field]) + val = findInTable(conn,"CATEGORY","category",testField,"categoryid") keys[field]=val if field == "CORE": val = findInTable(conn,"CORE","coredef",row[field],"coreid") diff --git a/Testing/addToRegDB.py b/Testing/addToRegDB.py index 9fdbe7df..3e7a54a6 100755 --- a/Testing/addToRegDB.py +++ b/Testing/addToRegDB.py @@ -223,7 +223,11 @@ def addRows(conn,elem,tableName,full): for field in common: if field in VALKEYFIELD: if field == "CATEGORY": - val = findInTable(conn,"CATEGORY","category",row[field],"categoryid") + # Remove type extension to get category name so that + # all types are maped to same category which will + # help for post processing. + testField=re.sub(r'^(.*)[:]([^:]+)(F16|F32|F64|Q31|Q15|Q7)$',r'\1',row[field]) + val = findInTable(conn,"CATEGORY","category",testField,"categoryid") keys[field]=val if field == "CORE": val = findInTable(conn,"CORE","coredef",row[field],"coreid") diff --git a/Testing/bench.txt b/Testing/bench.txt index c95e6d48..c4a9a3ad 100755 --- a/Testing/bench.txt +++ b/Testing/bench.txt @@ -1297,6 +1297,12 @@ group Root { REV = [0,1] } + Params CFFT4_PARAM_ID = { + NB = [16,64,256] + IFFT = [0,1] + REV = [0,1] + } + Params RFFT_PARAM_ID = { NB = [32,64,128,256] IFFT = [0,1] @@ -1313,7 +1319,7 @@ group Root { test_cfft_f32:test_cfft_f32 -> CFFT_PARAM_ID test_rfft_f32:test_rfft_f32 -> RFFT_PARAM_ID test_dct4_f32:test_dct4_f32 -> DCT_PARAM_ID - test_cfft_radix4_f32:test_cfft_radix4_f32 -> CFFT_PARAM_ID + test_cfft_radix4_f32:test_cfft_radix4_f32 -> CFFT4_PARAM_ID test_cfft_radix2_f32:test_cfft_radix2_f32 -> CFFT_PARAM_ID } } @@ -1341,6 +1347,12 @@ group Root { REV = [0,1] } + Params CFFT4_PARAM_ID = { + NB = [16,64,256] + IFFT = [0,1] + REV = [0,1] + } + Params RFFT_PARAM_ID = { NB = [32,64,128,256] IFFT = [0,1] @@ -1357,7 +1369,7 @@ group Root { test_cfft_q31:test_cfft_q31 -> CFFT_PARAM_ID test_rfft_q31:test_rfft_q31 -> RFFT_PARAM_ID test_dct4_q31:test_dct4_q31 -> DCT_PARAM_ID - test_cfft_radix4_q31:test_cfft_radix4_q31 -> CFFT_PARAM_ID + test_cfft_radix4_q31:test_cfft_radix4_q31 -> CFFT4_PARAM_ID test_cfft_radix2_q31:test_cfft_radix2_q31 -> CFFT_PARAM_ID } } @@ -1385,6 +1397,12 @@ group Root { REV = [0,1] } + Params CFFT4_PARAM_ID = { + NB = [16,64,256] + IFFT = [0,1] + REV = [0,1] + } + Params RFFT_PARAM_ID = { NB = [32,64,128,256] IFFT = [0,1] @@ -1401,7 +1419,7 @@ group Root { test_cfft_q15:test_cfft_q15 -> CFFT_PARAM_ID test_rfft_q15:test_rfft_q15 -> RFFT_PARAM_ID test_dct4_q15:test_dct4_q15 -> DCT_PARAM_ID - test_cfft_radix4_q15:test_cfft_radix4_q15 -> CFFT_PARAM_ID + test_cfft_radix4_q15:test_cfft_radix4_q15 -> CFFT4_PARAM_ID test_cfft_radix2_q15:test_cfft_radix2_q15 -> CFFT_PARAM_ID } } diff --git a/configCore.cmake b/configCore.cmake index e6ab198f..0a94d401 100644 --- a/configCore.cmake +++ b/configCore.cmake @@ -8,6 +8,7 @@ option(HARDFP "Hard floating point" ON) option(LITTLEENDIAN "Little endian" ON) option(FASTMATHCOMPUTATIONS "Fast Math enabled" OFF) option(FLOAT16 "Scalar float16 supported" OFF) +option(HYBRID "Hybrid instrinsics" ON) # More detailed identification for benchmark results SET(COREID ARMCM7) @@ -95,6 +96,9 @@ function(configcore PROJECTNAME ROOT) SET(HARDFP ON) SET(LITTLEENDIAN ON) SET(COREID ARMv81MML_DSP_DP_MVE_FP PARENT_SCOPE) + if (HYBRID) + target_compile_definitions(${PROJECTNAME} PRIVATE __ARM_MVE_HYBRID_INTRINSICS) + endif() endif() # CORTEX-M35