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

Fix testbench xt build fail #8289

Merged
merged 2 commits into from
Oct 6, 2023
Merged

Conversation

singalsu
Copy link
Collaborator

@singalsu singalsu commented Oct 5, 2023

No description provided.

@lgirdwood lgirdwood marked this pull request as ready for review October 5, 2023 15:00
@@ -121,7 +121,7 @@ void mfcc_fill_prev_samples(struct mfcc_buffer *buf, int16_t *prev_data,

buf->s_avail -= prev_data_length;
buf->s_free += prev_data_length;
buf->r_ptr = in;
buf->r_ptr = (void *)in; /* int16_t pointer but direct cast is not possible */
Copy link
Member

Choose a reason for hiding this comment

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

is in the wrong ptr type, do we need to look at other changes here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's up to @andrula-song to confirm but in the patch she used ae_int32 type to load two ae_int16 types, that's in comments a few lines above this typecast. I was wondering too if this can be correct but it appears so.

Copy link
Member

Choose a reason for hiding this comment

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

ok, intrinsic types are non portable. Lets revisist as we do need to support AVX here (and the API would need to become more generic).

Copy link
Contributor

Choose a reason for hiding this comment

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

@singalsu @lgirdwood , I used to use AE_LA16X4_XC to load a 16bit * 4 data, but I found the result is not right, I think it is a bug of xtensa. So I use AE_L32_XC to load a 32bit data(16bit * 2) to replace twice AE_L16_XC, and force the datatype to ae_int16 to copy the last 16 bit if the input data size is odd.

@@ -1578,10 +1578,12 @@ int module_adapter_reset(struct comp_dev *dev)
}
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
if (IS_PROCESSING_MODE_SINK_SOURCE(mod)) {
int i;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we could build testbench in C99 mode. When we build SOF currently (at least Zephyr builds), we are using C99 mode:

-std=c99 -std=gnu99

... so basicly C99'ism can pass through our CI checks and testbench will always be in catch-up mode. Zephyr is C99+ -> https://docs.zephyrproject.org/latest/develop/languages/c/index.html

That's a harder question where to set this, but would be a longer term solution.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Need to check how to add this, this commit could be possible to drop with that change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Using "std=c99 -std=gnu99 -fgnu89-inline" seems to work, thanks for suggestion!

This patch adds "-std=c99 -std=gnu99 -fgnu89-inline options"
to host architecture build to prevent error with
"scripts/rebuild-testbench -p tgl".

    src/audio/module_adapter/module_adapter.c:
    In function ‘module_adapter_reset’:

    src/audio/module_adapter/module_adapter.c:1582:
    error: ‘for’ loop initial declaration used outside C99 mode

    src/audio/module_adapter/module_adapter.c:1584: error:
    redefinition of ‘i’

Signed-off-by: Seppo Ingalsuo <[email protected]>
Build with "scripts/rebuild-testbench -p tgl" fails to error:

src/audio/mfcc/mfcc_hifi3.c: In function ‘mfcc_source_copy_s16’:
src/audio/mfcc/mfcc_hifi3.c:91: warning:
assignment from incompatible pointer type

src/audio/mfcc/mfcc_hifi3.c: In function ‘mfcc_fill_prev_samples’:
src/audio/mfcc/mfcc_hifi3.c:124: warning:
assignment from incompatible pointer type

src/audio/mfcc/mfcc_hifi3.c: In function ‘mfcc_fill_fft_buffer’:
src/audio/mfcc/mfcc_hifi3.c:159: warning:
assignment from incompatible pointer type

fixes: d0cb478 ("Audio: MFCC: Add HiFi3 implementation of MFCC")

Signed-off-by: Seppo Ingalsuo <[email protected]>
@singalsu singalsu force-pushed the testbench_xt_fixes branch from 4cef327 to 2da8ab7 Compare October 6, 2023 08:07
@@ -121,7 +121,7 @@ void mfcc_fill_prev_samples(struct mfcc_buffer *buf, int16_t *prev_data,

buf->s_avail -= prev_data_length;
buf->s_free += prev_data_length;
buf->r_ptr = in;
buf->r_ptr = (void *)in; /* int16_t pointer but direct cast is not possible */
Copy link
Member

Choose a reason for hiding this comment

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

ok, intrinsic types are non portable. Lets revisist as we do need to support AVX here (and the API would need to become more generic).

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Thanks @singalsu !

@kv2019i kv2019i merged commit 09e1b87 into thesofproject:main Oct 6, 2023
37 of 38 checks passed
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.

4 participants