-
Notifications
You must be signed in to change notification settings - Fork 349
Convert the mixin module to use the module adapter #6836
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
Conversation
bf63c12 to
5e8cb39
Compare
5e8cb39 to
b48fb8b
Compare
d661254 to
b3c89ef
Compare
f9929bb to
16133e9
Compare
|
@ranj063 can you check internal CI thanks. |
ae5793d to
7b09c9e
Compare
@lgirdwood looking into it. Looks like the gain quality test is failing. |
7b09c9e to
d99dc59
Compare
|
SOFCI TEST |
fc12b41 to
cd789e4
Compare
|
SOFCI TEST |
3 similar comments
|
SOFCI TEST |
|
SOFCI TEST |
|
SOFCI TEST |
cd789e4 to
15051d8
Compare
kv2019i
left a comment
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.
Nothing major, some minor comments, please see inline.
| size_t size = MAX(mod->deep_buff_bytes, mod->period_bytes); | ||
| uint32_t min_free_frames = UINT_MAX; | ||
| uint32_t num_input_buffers = 0; | ||
| uint32_t num_output_buffers = 0; |
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.
Not really specific to this PR, but the "copy()" starts to be very complex. I wonder if some of this logic could be moved to some less-often-run function. Could we even have a separate copy for the "simple_copy case"?
| base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params); | ||
|
|
||
| /* Buffers between mixins and mixouts are not used (mixin writes data directly to mixout | ||
| * sink). But, anyway, let's setup these buffers properly just in case. |
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.
This feels quit out-of-place, but as this is existing comment (and code) moved as-is, not need to block because of this.
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.
the comment could be a bit "kinder" though at least, stating some "better sounding" reason than "just in case," e.g. "for correctness," "for consistency" etc. But yes, it's just a verbatim copy of the current comment
|
|
||
| dev->ipc_config.frame_fmt = frame_fmt; | ||
| mod->simple_copy = true; | ||
| mod->skip_src_buffer_invalidate = true; |
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.
Minor thing, but the commit leaves a bit open why the modules need the ability to do this. This does add two code branches to a very common code path (the module process). I wonder if it's more efficient to just remove the extra writebacks from modules, and if there a few cases where this can't be done, pay the cost only for these cases.
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.
@kv2019i I think we need to clean this up for sure to not allow modules to do the WB/invalidates. But for now, I want to leave it as is to reduce the amount of changes.
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.
The cache work needs to go in the module core, however, agree we should do teh module conversion first and then do the cache work (when hopefully the Zephyr cache API is ready).
|
@wszypelt "System/merge/codecheck" error hit with this one as well.. |
15051d8 to
2d9da91
Compare
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 still don't like this. We're in .copy() i.e. in the pipeline task, actually performing streaming, right? These buffers can only be modified when modifying topology, i.e. either when connecting or when disconnecting pipelines. Those actions should also only be done in a pipeline task context. As long as we only allow connected pipelines on the same core, these tasks will run sequentially without preempting each other. So within one scheduling invocation these buffers remain consistent.
Only when we move to connecting different cores, then this will become a problem. But even then this will be a larger problem, requiring proper robust locking. And if we ever hit this condition, it means we were in an inconsistent state and it can bite us elsewhere. These checks seem only to reduce the probability of hitting a problem, making it more difficult to debug and fix. Really don't seem useful to me. Same below of course.
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.
@lyakh I'm fully with you that this does not seem right in copy (we should have less frequent state change callbacks where module can react to changes in its configuration or the configuration of its immediate connections, and NOT do this check in each copy), but it's still a fact that currently this is hit in pause-resume tests (with sof-tests), so it's not like this is a corner case at this point.
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.
oh i missed these 2. fixed now
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.
@lyakh I'm fully with you that this does not seem right in copy (we should have less frequent state change callbacks where module can react to changes in its configuration or the configuration of its immediate connections, and NOT do this check in each copy), but it's still a fact that currently this is hit in pause-resume tests (with sof-tests), so it's not like this is a corner case at this point.
@kv2019i if it's so easy to hit, then we really need to investigate and fix these properly. Maybe someone could add a task to our planning ;-)
kv2019i
left a comment
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.
Thanks, this is cleaner than my #6909 .
The concern raised by Guennadi on whether copy()/process() has to have so much conditional code, remains on open, but not really specific to this PR. Given I can easily hit these conditions with sof-test, it would seem this requires a separate PR (if someone disagrees, please chime in).
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.
Yup, this is cleaner,
Add a helper function to set up the input/output buffers for the 1:1 and N:1 source:sink buffer configuration. Also, expand the module_adapter_copy() function to support the simple_copy flag with the single source and multiple sink buffer configuration. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Replace the comp_drv ops for the mixin component to use the module_adapter interface. The trigger and get_attribute ops are replaced with the module_adapter ops which do the exact same thing. The base_cfg field from struct mixin_data is removed as it is replaced with the base_cfg in struct module_config and all users have been updated. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
…back Some modules like the mixin/mixout do the invalidate/writebacks for the source/sink buffers themselves. So, add flags in struct processing_module to skip doing the same again in the module adapter code. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
In the simple_copy case, source/sink modules that aren't active are skipped when passing the buffers to the process callback. So, produce/consume from only the active buffers that were passed to the process callback as well. Reported-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
2d9da91 to
5414c49
Compare
| base_module_cfg_to_stream_params(&mod->priv.cfg.base_cfg, params); | ||
|
|
||
| /* Buffers between mixins and mixouts are not used (mixin writes data directly to mixout | ||
| * sink). But, anyway, let's setup these buffers properly just in case. |
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.
the comment could be a bit "kinder" though at least, stating some "better sounding" reason than "just in case," e.g. "for correctness," "for consistency" etc. But yes, it's just a verbatim copy of the current comment
|
@ranj063 btw, what's module adapter plan for N:1 and M:N based processing optimisation ? |
@lgirdwood N:1 is already supported by the module adapter. M:N is the only open. I dont have a line of sight for this one due to the lack of a module for this type. Maybe what we need to think of extending the passthrough module to support M:N confg instead of 1:1 so we can test this. WHat do you think? |
|
@ranj063 lets leave M:N then for later. |
No description provided.