-
Notifications
You must be signed in to change notification settings - Fork 349
audio: volume: Align volume vector to cache line size #10394
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
audio: volume: Align volume vector to cache line size #10394
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the volume component to use cache-line-aligned memory allocation for the volume vector, ensuring compatibility with HIFI-optimized processing callbacks that require proper alignment. This represents a pragmatic solution following the KISS principle rather than implementing a more complex architecture-specific alignment mechanism.
- Changed volume vector allocation from
mod_alloc()tomod_alloc_align()withCONFIG_DCACHE_LINE_SIZEalignment - Applied the change consistently across both IPC3 and IPC4 implementations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/audio/volume/volume_ipc4.c | Updated volume vector allocation to use cache-line alignment |
| src/audio/volume/volume_ipc3.c | Updated volume vector allocation to use cache-line alignment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Turned this to draft as cache line size is quite an overkill for HIFI5 instruction data alignment that is 16 bits. Need to come up with some elegant solution for that. |
Speaking with @singalsu the Hifi vector size being used depends on both the HiFi version, the audio format and the operation. Its safest to probably allocate with alignment on the largest vector size for the HiFi version. @jsarha can you update to add the macros that define the correct size for each HIFI verion in common/sof.h e.g. #define HIFI4_VECTOR_ALIGN 64and so on for each HIFI version. @singalsu can help provide the alignments. |
@lgirdwood we already have this: Line 209 in 718b745
shouldn't I use it, instead of creating new macros? |
Some of the HIFI optimized versions of the volume processing callbacks require the volume vector to be suitably aligned. SOF_FRAME_BYTE_ALIGN is created exactly for this purpose. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1d7436b to
b873c82
Compare
Some of the HIFI optimized versions of the volume processing callbacks require the volume vector to be suitably aligned. Cache line size should be good enough for all versions.
The ultimate over engineered solution would be some mechanism for the used implementation (HIFI3/4/5 or generic with max volume needed or not permutation) pass the information of the required alignment to the init function, but following the KISS principle this is as good as it gets.