-
Notifications
You must be signed in to change notification settings - Fork 322
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
[BUG] [IIR] IIR not working with SOF compiled with XCC RJ2024.3 #9350
Comments
From the crash and after analyzing the disassembly I've realized the error is here:
By comparing the two disassembles from RI2023 (which is ok) and RJ2024 (which is NOK): At first, I checked that all the variables are aligned based on the instructions restrictions and they seem to be (if we look at the VADDR or A2, A3, etc from crash dump). I also wrote a simple function that does a store and load (trying to reproduce the order of instructions from where the crash happens), with the exact addresses:
With this, the disassembly looks similar to the crash - meaning is doing a store (
|
@iuliana-prodan I would raise a ticket with Cadence here as code works with old compiler and not new compiler. This could mean we need a #ifdef or pragma or indeed if our code is wrong here. |
Yep, good debugging work @iuliana-prodan ! Help from Cadence would be really useful with this. |
@iuliana-prodan short term you could put an ifdef that does a less optimal flow here and enable the iffdef via Kconfig as a compiler Work Around ? |
I've raised a ticket to cadence "Case# 46820991: Sound Open Firmware code not working with latest XCC toolchain RJ2024.3" but no useful answer. TBH I have no idea how to less optimize this code. The problem could be reading from the input buffers here: https://github.com/thesofproject/sof/blob/main/src/math/iir_df1_hifi3.c#L90-L95. Same here https://github.com/thesofproject/sof/blob/main/src/math/iir_df1_hifi3.c#L106-L110. |
@singalsu looks like we have some gaps in the APIs for aligning MIN(copy_size). @iuliana-prodan these APIs are meant to adapt to HiFi flavor, but this sounds like a bug if you see unaligned access. Can you try something like diff --git a/src/math/iir_df1_hifi3.c b/src/math/iir_df1_hifi3.c
index 39be8e3a6..ba97605be 100644
--- a/src/math/iir_df1_hifi3.c
+++ b/src/math/iir_df1_hifi3.c
@@ -70,8 +70,8 @@ int32_t iir_df1(struct iir_state_df1 *iir, int32_t x)
return x;
/* Coefficients order in coef[] is {a2, a1, b2, b1, b0, shift, gain} */
- coefp = (ae_int32x2 *)&iir->coef[0];
- delayp = (ae_int32x2 *)&iir->delay[0];
+ coefp = __builtin_assume_aligned((ae_int32x2 *)&iir->coef[0], THE_HIFI_VERSION_DATASIZE);
+ delayp = __builtin_assume_aligned((ae_int32x2 *)&iir->delay[0], THE_HIFI_VERSION_DATASIZE);
for (j = 0; j < iir->biquads; j += nseries) {
/* the first for loop is for parallel EQs, and they have the same input */
in = x;
''' |
@lgirdwood sorry for the late reply, I was OOO. I've tried your suggestion and it still doesn't work.
The generated disassembly code is also the same. |
ok - I would expect this compiler directive to be honored, definitely worth getting input from cadence on their compiler. |
Describe the bug
Compiled SOF successfully with XCC toolchain RJ2024.3 from Cadence.
When trying to run an IIR test I get a
load/store error
on DSP:In Linux I get an
Input/output error
:To Reproduce
Use an IIR topology and run the following commands:
Reproduction Rate
With latest SOF - main branch, with XCC RJ2024.3, the error is met 100%.
This was reproduced on all i.MX platforms: i.MX8MP, i.MX8QM, i.MX8QXP.
With XCC RI2023.11 everything works fine.
Expected behavior
No error should appear.
Impact
Not working as expected.
Showstopper for IIR, if updating to latest XCC toolchain.
Environment
Screenshots or console output
I've attached here the disassembly for OK XCC 2023 SOF and NOT OK XCC 2024 SOF.
zephyr_2023_OK.dst.txt
zephyr_2024_NOK.dst.txt
The text was updated successfully, but these errors were encountered: