Audio Processing Benchmark

December 8, 2024 ยท View on GitHub

Operation Level Benchmark

The table below lists the benchmark cases at the operation level.

NameBuild TargetIntroduction
Biquad Opninja dap-op-biquad-benchmarkThis benchmark evaluates the efficiency of scalar implementation of the Biquad operator and verifies their accuracy against KFR's biquad function. The benchmark options can be configured in this file.
Note: The vectorized implementation of the biquad filter is the same as the IIR operator. Please refer to the 'IIR Op' for details.
FFT Opninja dap-op-fft-benchmarkTask in TODO list. Check the benchmark in this file.
FIR Opninja dap-op-fir-benchmarkThis benchmark evaluates the efficiency of both scalar and vectorized implementation of the FIR operator and verifies their accuracy against KFR's FIR function. The benchmark options can be configured in this file.
IIR Opninja dap-op-iir-benchmarkThis benchmark evaluates the efficiency of both scalar and vectorized implementations of the IIR operator and verifies their accuracy against KFR's IIR function. The benchmark options can be configured in this file.
RFFT Opninja dap-op-rfft-benchmarkThis benchmark evaluates the efficiency of the RFFT operator and verifies its correctness by comparing it with the RFFT function in numpy. The benchmark size can be adjusted in this file. And you can compare the time consumption with Numpy library in the numpyTimeResult.txt.

Local Hardware Platform.

  1. Set KFR library:
$ cd buddy-benchmark
$ git submodule update --init ./thirdparty/kfr
  1. Build benchmark for local platform:
$ cd ../buddy-mlir/build
$ export BUDDY_MLIR_BUILD_DIR=$PWD
$ export LLVM_MLIR_BUILD_DIR=$PWD/../llvm/build
$ cd ../../buddy-benchmark
$ mkdir build && cd build
$ cmake -G Ninja .. \
    -DCMAKE_BUILD_TYPE=RELEASE \
    -DAUDIO_PROCESSING_BENCHMARKS=ON \
    -DCMAKE_CXX_COMPILER=${LLVM_MLIR_BUILD_DIR}/bin/clang++ \
    -DKFR_DIR=$PWD/../thirdparty/kfr \
    -DBUDDY_MLIR_BUILD_DIR=${BUDDY_MLIR_BUILD_DIR}
$ ninja <target benchmark>
// For example: 
$ ninja dap-op-iir-benchmark
  1. Run the benchmark on your local platform:
// For example:
$ cd bin
$ ./dap-op-iir-benchmark

audio-plot tool

  1. Install required packages:

To help visualize the results of audio processing, we provide a tool for figure plotting. To use this tool, ensure that you are running Python3 and have the necessary packages installed: NumPy, Matplotlib and SciPy. You can install them using the following command:

$ pip install numpy matplotlib scipy
  1. Build benchmark for local platform:

You can customize the Python3 path during the build process by adding the option -DPYTHON_BINARY_DIR=/PATH/TO/PYTHON/BIN as follows:

$ cd build
$ cmake -G Ninja .. \
    -DAUDIO_PROCESSING_BENCHMARKS=ON \
    -DCMAKE_CXX_COMPILER=clang++ \
    -DKFR_DIR=/PATH/TO/KFR/SOURCE/CODE \
    -DBUDDY_MLIR_BUILD_DIR=/PATH/TO/BUDDY-MLIR/BUILD \
    -DPYTHON_BINARY_DIR=/PATH/TO/PYTHON/BIN/
$ ninja audio-plot
  1. Run audio-plot on your local platform:

Once the processing is complete, you can use this tool to plot a comparision figure:

$ cd bin
$ ./audio-plot ../../benchmarks/AudioProcessing/Audios/NASA_Mars.wav ResultKFRIir.wav

The result is saved in bin/res.png. For additional usage details, run audio-plot -h to view the help information.