Skip to content

Audio: Optimize division by speed of sound using fixed-point reciprocal#9160

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
ShriramShastry:shastry_perf_inv_sound_speed_optimization
Jun 26, 2024
Merged

Audio: Optimize division by speed of sound using fixed-point reciprocal#9160
lgirdwood merged 1 commit into
thesofproject:mainfrom
ShriramShastry:shastry_perf_inv_sound_speed_optimization

Conversation

@ShriramShastry

Copy link
Copy Markdown
Contributor

This commit optimizes the division by the speed of sound in the theoretical_time_differences function. By precomputing the fixed-point reciprocal of the speed of sound, we eliminate the need for a costly division operation in each iteration.

@ShriramShastry

Copy link
Copy Markdown
Contributor Author

SOFCI

@singalsu

Copy link
Copy Markdown
Collaborator

Thanks @ShriramShastry , this saves 1.4 MCPS with 4ch beamformer in TGL platform. I'll review this PR later.

@ShriramShastry
ShriramShastry marked this pull request as ready for review May 23, 2024 16:23
@ShriramShastry
ShriramShastry force-pushed the shastry_perf_inv_sound_speed_optimization branch 3 times, most recently from 09f83ff to 0a29b59 Compare May 27, 2024 07:02

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one @ShriramShastry !

Comment thread src/include/sof/math/numbers.h Outdated
Comment thread src/audio/tdfb/tdfb_direction.c Outdated
@ShriramShastry
ShriramShastry force-pushed the shastry_perf_inv_sound_speed_optimization branch from 0a29b59 to 849bce3 Compare June 11, 2024 15:21
@ShriramShastry
ShriramShastry requested a review from singalsu June 11, 2024 15:30
@ShriramShastry
ShriramShastry force-pushed the shastry_perf_inv_sound_speed_optimization branch from 849bce3 to ef64f75 Compare June 13, 2024 15:45

@singalsu singalsu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code works correctly, checked with direction_test.m but need to reject due to mistakes in comments, sorry! Can you please fix. This is a quick approve after done.

Comment thread src/audio/tdfb/tdfb_direction.c Outdated
Comment thread src/audio/tdfb/tdfb_direction.c Outdated
Comment thread src/include/sof/math/numbers.h Outdated
@ShriramShastry
ShriramShastry force-pushed the shastry_perf_inv_sound_speed_optimization branch from ef64f75 to 9186364 Compare June 17, 2024 14:36
@kv2019i

kv2019i commented Jun 20, 2024

Copy link
Copy Markdown
Collaborator

Ready to merge, pending the mandatory CI to pass.

This commit optimizes the division by the speed of sound in the
`theoretical_time_differences` function. By precomputing the fixed-point
reciprocal of the speed of sound, we eliminate the need for a costly
division operation in each iteration.

Additionally, a redundant 'if' statement is removed from the
'tdfb_direction_copy_emphasis' function, simplifying the code.

Signed-off-by: Shriram Shastry <malladi.sastry@intel.com>
@ShriramShastry
ShriramShastry force-pushed the shastry_perf_inv_sound_speed_optimization branch from 9186364 to b39cd56 Compare June 23, 2024 16:51
@lgirdwood

Copy link
Copy Markdown
Member

@wszypelt looks like CI has been pending a while. Good to merge ?

@lgirdwood lgirdwood added this to the v2.11 milestone Jun 25, 2024
@wszypelt

Copy link
Copy Markdown

@lgirdwood good to merge :)

@lgirdwood
lgirdwood merged commit b12b69f into thesofproject:main Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants