Skip to content

Conversation

@marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Jan 10, 2024

  1. The if XCHAL_HAVE_HIFI4 macro logic is duplicated across many source files. Starting with dcblock.h, make it generic and move it to common.h

  2. Add the ability to override the max available HIFI level using Kconfig

@marc-hb marc-hb changed the title Add new CONFIG_DCBLOCK_HIFI and move generic logic to common.h Add new CONFIG_DCBLOCK_HIFI and move generic XCHAL_HAVE logic to common.h Jan 10, 2024
…on.h

1. The `if XCHAL_HAVE_HIFI4` macro logic is duplicated across many
source files. Starting with dcblock.h, make it generic and move it to
common.h

2. Add the ability to override the max available HIFI level using
Kconfig

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb
Copy link
Collaborator Author

marc-hb commented Jan 10, 2024


config DCBLOCK_HIFI
int "DC Blocking Filter HIFI level (-1 = max)"
default -1
Copy link
Member

@lgirdwood lgirdwood Jan 10, 2024

Choose a reason for hiding this comment

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

can we depend on ARCH_XTENSA and make this a Kconfig choice (where each choice would depend on ARCH_XTENSA_HIFI_n set by top level PLATFORM Kconfig) ?

Btw, I think Peter Mitsis (@peter-mitsis) will have the HiFi flavour landing in Zephyr soon as part of the HiFi context save/restore work. i.e. we can reuse RTOS supplied Kconfig data.

Whatever methodology we use, it should also scale to x86 and ARM SIMD.

Copy link
Contributor

Choose a reason for hiding this comment

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

where is ARCH_XTENSA and ARCH_XTENSA_HIFI_n definition? is it already exist or added later?

Copy link
Contributor

Choose a reason for hiding this comment

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

also, there is no HIFI option for this module, no HIFI3 and HIFI4 option.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

also, there is no HIFI option for this module, no HIFI3 and HIFI4 option.

In this prototype you enter '3' or '4' or any version you like. @lgirdwood already requested a Kconfig choice

Please spend more time reading and make sure you understand better before commenting.

Copy link

@peter-mitsis peter-mitsis Jan 11, 2024

Choose a reason for hiding this comment

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

Just to confirm, I am indeed working on adding HiFi DSP support in Zephyr so that its registers will be saved/restored on relevant context switches.

EDIT: now at:

Copy link
Contributor

Choose a reason for hiding this comment

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

@peter-mitsis , do you mean you will adding HIFI related config into zephyr, then SOF can directly leverage it?

Copy link
Member

Choose a reason for hiding this comment

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

All - @peter-mitsis will need to define a SOC level Kconfig to indicate the HIFI level on xtensa. i.e. this will say hifi3, hifi4, hifi5 etc as the different hifi ISA add additional register that must be saved/restored.
This same Kconfig can be reused here to indicate the highest HIFI SIMD level for each platform/SOC i.e. some menuconfig options will depend on this Zephyr SOC Kconfig.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All - @peter-mitsis will need to define a SOC level Kconfig to indicate the HIFI level on xtensa.

My attempt to do this:

Just prototype and draft but a functional one so please review.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you all, then this open will be resolved soon.
let's wait for Peter's PR to zephyr and got merged.

@peter-mitsis , could you share PR link here once you submit here? or add me into review list for the zephyr PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#8787 is similar to this but with a Kconfig choice instead.

#define IS_ENABLED_STEP_3(ignore, value, ...) (!!(value))
#endif

#define SOF_AUTO_HIFI -1
Copy link
Member

Choose a reason for hiding this comment

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

Will need to namespace these as SOF_ARCH_XTENSA_feature


config DCBLOCK_HIFI
int "DC Blocking Filter HIFI level (-1 = max)"
default -1
Copy link
Contributor

Choose a reason for hiding this comment

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

where is ARCH_XTENSA and ARCH_XTENSA_HIFI_n definition? is it already exist or added later?

# define SOF_MAX_XCHAL_HIFI SOF_NO_HIFI
#else
# include <xtensa/config/core-isa.h>
// Maybe we could make this fully generic (and less readable!) using
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure this is best way to go, with this, module HIFI config still depend on core-isa, this is centuralized.

The logic is more complex and with more dependency, like XCC, more complex SOF_USE_HIFI macro definition, if expand this to other dsp platform(non-xtensa and X86), this part will need change again and hard to make changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

module HIFI config still depend on core-isa, this is centuralized

You haven't summarized why these are bad.

We can duplicate core-isa.h in various places and I'm looking at options but core-isa.h will always remain the origin, true reference for HIFI facts.

with more dependency, like __XCC__

__XCC__ is the only reliable way to detect Cadence toolchains and it's what Zephyr uses.
#8682 (comment)

Which other dependency?

The logic is more complex [...] and hard to make changes.

If you find this logic complex then I'm afraid nothing can be done for you.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean maintain and expand complex, this logic is for xtensa, how about if a new architecture add? for example, ARM?

@marc-hb
Copy link
Collaborator Author

marc-hb commented Jan 12, 2024

can we depend on ARCH_XTENSA and make this a Kconfig choice (where each choice would depend on ARCH_XTENSA_HIFI_n set by top level PLATFORM Kconfig) ?

I did this in a separate PR because the code is totally different: no macros and everything in Kconfig:

It's not as tedious and verbose as I was afraid it would be BUT:

@marc-hb
Copy link
Collaborator Author

marc-hb commented Jan 26, 2024

Alternative #8787 has been merged.

@marc-hb marc-hb closed this Jan 26, 2024
@marc-hb marc-hb deleted the dcblock-hifi branch January 26, 2024 19:43
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