-
Notifications
You must be signed in to change notification settings - Fork 350
pipeline: allocate on specific heap #10539
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull request overview
Adds heap-aware pipeline allocation so pipelines (and related objects) can be placed on specific memory domains, including user-space heaps.
Changes:
- Extends
pipeline_new()to accept a heap parameter and stores it instruct pipeline - Updates IPC and unit tests to use the new
pipeline_new(NULL, ...)default-heap calling pattern - Adds a Zephyr userspace test that allocates a pipeline from the user heap and validates placement
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| zephyr/test/userspace/test_ll_task.c | Adds a userspace test that creates/frees a pipeline on the userspace heap |
| test/cmocka/src/audio/pipeline/pipeline_new.c | Updates cmocka test to the new pipeline_new() signature |
| src/ipc/ipc4/helper.c | Updates IPC4 pipeline creation to pass default heap (NULL) |
| src/ipc/ipc3/helper.c | Updates IPC3 pipeline creation to pass default heap (NULL) |
| src/include/sof/audio/pipeline.h | Adds heap parameter + pipeline->heap field and updates doc comment |
| src/audio/pipeline/pipeline-schedule.c | Allocates pipeline tasks from the pipeline heap |
| src/audio/pipeline/pipeline-graph.c | Allocates/frees pipeline objects from a selectable heap |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| /* allocate new pipeline */ | ||
| p = rzalloc(SOF_MEM_FLAG_USER, sizeof(*p)); | ||
| p = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, sizeof(*p), 0); |
Copilot
AI
Feb 11, 2026
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.
Using an explicit alignment of 0 relies on sof_heap_alloc() default behavior. Since this allocates a struct, it’s safer/clearer to pass an explicit alignment (e.g., __alignof__(*p) / alignof(struct pipeline) or the project’s default alignment constant) to prevent misalignment if a heap implementation changes.
| p = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, sizeof(*p), 0); | |
| p = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, sizeof(*p), __alignof__(*p)); |
zephyr/test/userspace/test_ll_task.c
Outdated
|
|
||
| /* Free pipeline */ | ||
| ret = pipeline_free(p); | ||
| zassert_equal(ret, 0, "pipeline free failed"); |
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.
zassert_ok(ret,...)
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.
Why not, need to change for V2, so I'll change this as well (although not a fan of the million variants of ztest asserts).
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 a fan
oh, I find them cute
| struct pipeline *pipeline_new(uint32_t pipeline_id, uint32_t priority, uint32_t comp_id, | ||
| struct create_pipeline_params *pparams) | ||
| struct pipeline *pipeline_new(struct k_heap *heap, uint32_t pipeline_id, uint32_t priority, | ||
| uint32_t comp_id, struct create_pipeline_params *pparams) |
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.
Fwiw, I will be changing this to pass in a vregion soon.
|
Fail in cmocka, debugging ongoing. |
Add a heap parameter to pipeline allocation functions. This makes it possible to control how allocations are done with pipeline granularity and makes it possible to move pipelines to user-space. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add a simple test to allocate a pipeline using a user-space memory heap and verify creation is successful. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Fix copy and paste error in documentation for pipeline_prepare(). Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Fix copy and paste error in documentation for pipeline_schedule_copy(). Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
3e60e0a to
c51bfa6
Compare
|
V2 pushed:
|
Add a heap parameter to pipeline allocation functions. This makes it possible to control how allocations are done with pipeline granularity and makes it possible to move pipelines to user-space.
Second patch adds a test case that uses the new interface to create pipelline in user-space memory domain.
Third patch is a trivial documentation fix to pipeline.h.