Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsps_dotprod_f32 is slow on first call (examples/dotprod) (DSP-121) #78

Open
Bobobel opened this issue Dec 12, 2023 · 1 comment
Open

Comments

@Bobobel
Copy link

Bobobel commented Dec 12, 2023

Environment

  • Development Kit: [ESP32S3-Box-3]
  • Espressif IDF version [1.6.5] and IDF [5.1.2]
  • Build System: [CMake]
  • Compiler version xtensa-esp32s3-elf
  • Operating System: [Windows]
  • Power Supply: [USB]
  • I used DSP optimization as well as compiler opt -O2 (thanks, that this is possible with S3)

Problem Description

That example includes some bugs!
I fixed them (producing a sum of squares) and checked for other input as well as repeated timings:

Results:

I (1422) main: Start Example.
I (1422) main: The sum of N squares from 1 to N=256 = 5625216.000000 (reference=5625216)
I (1432) main: Operation for N samples take 2639 cycles
I (1432) main: End Example.
I (1432) main: The sum of N squares from 1 to N=256 = 5625216.000000 (reference=5625216)
I (1442) main: Operation for N samples take 429 cycles
I (1452) main: End Example.

Then I increased N to get (only second reading):
1581 cycles for N=1024 , factor=3.68
3117 cycles for N=2048 , factor=7.39
6189 cycles for N=4096 , factor=14.43
Fine, it is scaling as expected.

Expected Behavior

Maybe you can decrease setup time for first call of that routine? I guess it will not pay because usually dotprod will be called repeatedly.

Actual Behavior

Steps to repropduce

just double the test in main

"It is not a fault its a feature" (:->

@github-actions github-actions bot changed the title dsps_dotprod_f32 is slow on first call (examples/dotprod) dsps_dotprod_f32 is slow on first call (examples/dotprod) (DSP-121) Dec 12, 2023
@dmitry1945
Copy link
Collaborator

Hi @Bobobel

the timing for the first call is high because the dsps_dotprod_f32 is located in flash and should be copied to the cash after the first call. At second call it's already in cash, and the system don't spend time to copy it.

Regards,
Dmitry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants