-
Notifications
You must be signed in to change notification settings - Fork 8.2k
zdsp: Add ARC DSPLIB backend for zdsp #52478
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
Merged
carlescufi
merged 3 commits into
zephyrproject-rtos:main
from
SiyuanCheng-CN:siyuan-dsplib
Feb 21, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,9 +13,16 @@ if DSP | |
| config DSP_BACKEND_HAS_STATIC | ||
| bool | ||
|
|
||
| config DSP_BACKEND_HAS_AGU | ||
| bool | ||
|
|
||
| config DSP_BACKEND_HAS_XDATA_SECTION | ||
| bool | ||
|
|
||
| choice DSP_BACKEND | ||
| prompt "DSP library backend selection" | ||
| default DSP_BACKEND_CMSIS if CMSIS_DSP | ||
| default DSP_BACKEND_ARCMWDT if ARC && "$(ZEPHYR_TOOLCHAIN_VARIANT)" = "arcmwdt" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would suggest moving this up one line so we choose the right optimized default (feel free to do this in another PR in order to avoid getting another round of reviews). |
||
| default DSP_BACKEND_CUSTOM | ||
|
|
||
| config DSP_BACKEND_CMSIS | ||
|
|
@@ -32,6 +39,17 @@ config DSP_BACKEND_CUSTOM | |
| Rely on the application to provide a custom DSP backend. The implementation should be | ||
| added to the 'zdsp' build target by the application or one of its modules. | ||
|
|
||
| config DSP_BACKEND_ARCMWDT | ||
| bool "Use the mwdt library as the math backend" | ||
| depends on ARCMWDT_LIBC | ||
| depends on CMSIS_DSP | ||
SiyuanCheng-CN marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| select DSP_BACKEND_HAS_STATIC | ||
| select DSP_BACKEND_HAS_AGU | ||
| select DSP_BACKEND_HAS_XDATA_SECTION | ||
| help | ||
| Implement the various zephyr DSP functions using the MWDT-DSP library. This feature | ||
| requires the MetaWare toolchain and CMSIS module to be selected. | ||
|
|
||
| endchoice | ||
|
|
||
| endif # DSP | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Copyright (c) 2022 Synopsys | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| zephyr_include_directories(public) | ||
|
|
||
| zephyr_include_directories_ifdef(CONFIG_DSP_BACKEND_ARCMWDT | ||
| ${ARCMWDT_TOOLCHAIN_PATH}/MetaWare/arc/lib/src/dsp/include/ | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think that as we get more and more architecture backends we'll get more of these attributes. Can we use the same pattern as the static and have this as a Kconfig without a prompt in case ? maybe
config DSP_BACKEND_HAS_AGU? Similarly for the data attribute, we can have a string Kconfig for the section. My goal is to make as few custom (per architecture) switches.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.
I'm still a bit lost about the scalability of this approach, can you explain in more details how you see this when the next attribute comes up?
So lets assume we have
CONFIG_DSP_BACKEND_HAS_AGUand a new attributeCONFIG_DSP_BACKEND_HAS_X, does the code now look like: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.
I'd expect these would be mutual exclusive with at most a single attribute at a time. The _HAS refers to a specific hardware feature or flavor of DSP acceleration, so I don't expect a combination of _HAS_AGU and _HAS_X likely.
But now I understand your scalability concern better. Can we address it in the future when the case of HAS_AGU && HAS_X occurs?
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.
I also expect these are mutual exclusive, so the code shouldn't be such complex. I tried to use string Kconfig to directly pass attributes to C macro
DSP_DATAandDSP_STATIC_DATAso that there is no if statement in code. Kconfig and C macro definition might look like:#define DSP_DATA CONFIG_DSP_DATABut I found double quotes are introduced to C macro by make itself, which is unrecognizable by compiler. If this can be solved, the code can be simple.