Skip to content

dax: add an instance manager#10688

Merged
lgirdwood merged 1 commit intothesofproject:mainfrom
checkupup:main_dax_user_priority
Apr 27, 2026
Merged

dax: add an instance manager#10688
lgirdwood merged 1 commit intothesofproject:mainfrom
checkupup:main_dax_user_priority

Conversation

@checkupup
Copy link
Copy Markdown
Contributor

@checkupup checkupup commented Apr 8, 2026

When multiple DAX components are running simultaneously, instance resources may be insufficient. In this case, DAX instance manager ensures that higher-priority DAX components are always granted instance resources. For DAX components that cannot obtain instance resources in a timely manner, dax_process will operate in pass-through mode.

@sofci
Copy link
Copy Markdown
Collaborator

sofci commented Apr 8, 2026

Can one of the admins verify this patch?

reply test this please to run this test once

@lgirdwood
Copy link
Copy Markdown
Member

test this please

Copy link
Copy Markdown
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@checkupup are you able to add more inline comments describing the flow/mechanism and log when we have to fallback to pass through mode. How would priority be set by users, i.e. using topology tuples would mean same dax/sof binaries could be used but with different priorities depending on target.

@checkupup checkupup force-pushed the main_dax_user_priority branch from 5af4619 to a50b365 Compare April 14, 2026 03:19
@checkupup
Copy link
Copy Markdown
Contributor Author

@checkupup are you able to add more inline comments describing the flow/mechanism and log when we have to fallback to pass through mode.

Sure, see my latest commit.

@checkupup checkupup force-pushed the main_dax_user_priority branch from a50b365 to 2b0800b Compare April 15, 2026 07:12
@checkupup checkupup changed the title dax: add a user priority mechanism dax: add an instance manager Apr 15, 2026
@checkupup
Copy link
Copy Markdown
Contributor Author

To maintain code readability, I have extracted the entire instance resource handling logic into the file dax_instance_manager.c

@checkupup checkupup marked this pull request as ready for review April 20, 2026 03:32
@checkupup
Copy link
Copy Markdown
Contributor Author

Code Logic:

Assume that instance 1 is created first.

While Instance 1 is running, Instance 2 requests to be created. If Instance 2 has a higher priority than Instance 1, then during Instance 1's process loop, check_priority_l evaluates to false, causing Instance 1 to voluntarily release its held memory resources. Instance 2 checks for available memory on each iteration of its process loop; if memory is available, it proceeds to create the instance. Since Instance 1 has already released its memory, Instance 2 is successfully created. At this point, Instance 1 operates in passthrough mode.

Once Instance 2 finishes its work and releases the memory, if Instance 1 is still active, check_priority_l in its process loop evaluates to true. Instance 1 then re-requests the memory resources. Upon successfully acquiring them, it exits passthrough mode and resumes actual audio effect processing.

Note: The speaker instance has a higher priority than the headphone instance.

Copy link
Copy Markdown
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.

Some comments inline.

Comment thread src/audio/module_adapter/module/dolby/dax_instance_manager.c
Comment thread src/audio/module_adapter/module/dolby/dax.h Outdated
Comment thread src/audio/module_adapter/module/dolby/dax.h Outdated
Comment thread src/audio/module_adapter/module/dolby/dax.h Outdated
Comment thread src/audio/module_adapter/module/dolby/dax_instance_manager.c
Comment thread src/audio/module_adapter/module/dolby/dax_instance_manager.c
When multiple DAX components are running simultaneously, instance
resources may be insufficient. In this case, DAX instance manager
ensures that higher-priority DAX components are always granted
instance resources. For DAX components that cannot obtain instance
resources in a timely manner, `dax_process` will operate in
pass-through mode.

Signed-off-by: Jun Lai <jun.lai@dolby.com>
@checkupup checkupup force-pushed the main_dax_user_priority branch from 2b0800b to 8b8da99 Compare April 23, 2026 04:58
Copy link
Copy Markdown
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 @checkupup , looks good now!

@checkupup
Copy link
Copy Markdown
Contributor Author

Hi, @johnylin76 @lgirdwood Could you please review this change? Thx.

@lgirdwood lgirdwood merged commit 4b1de38 into thesofproject:main Apr 27, 2026
39 of 40 checks passed
@checkupup checkupup deleted the main_dax_user_priority branch April 28, 2026 02:50
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