Skip to content

Only heap size attribute - #10842

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
jsarha:only_heap_size_attribute
Jun 9, 2026
Merged

Only heap size attribute#10842
kv2019i merged 1 commit into
thesofproject:mainfrom
jsarha:only_heap_size_attribute

Conversation

@jsarha

@jsarhajsarha commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This PR is base on #10831 and should go in after it. It is also an integral part of soon to be pushed new version #10783 and should go in only after we are convinced of #10783 changes, automating division between vregion lifetime and interim allocations, and in effect moving most of allocations to lifetime linear part of the vregion heap.

This is a separate PR because this should go in before we tag the next SOF release, to not to let our IPC and topology attribute wandering to contaminate our SOF releases. That is if we get convinced of #10783 approach.

This is a pair with the soon to be pushed new version of thesofproject/linux#5537

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates module allocation helpers into the RTOS allocation headers and simplifies IPC4 DP/pipeline “memory requirement” attributes to a single heap size field, aiming to prevent interim/lifetime/shared attribute proliferation ahead of the next SOF release (and in preparation for follow-up vregion work referenced in the PR description).

Changes:

  • Move mod_alloc_ctx + sof_ctx_{alloc,zalloc,free}() API into rtos/alloc.h (Zephyr + POSIX) and delete src/include/sof/ctx_alloc.h.
  • Simplify IPC4 DP/pipeline memory requirement structs to use only heap_bytes and update related decode logging.
  • Adjust vregion.h stubs for !CONFIG_SOF_VREGIONS to no longer allocate/free a dummy struct vregion and to return NULL for vregion ops.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
FileDescription
zephyr/include/rtos/alloc.hAdds mod_alloc_ctx and sof_ctx_* helpers (with vregion support) directly in RTOS alloc header.
posix/include/rtos/alloc.hAdds POSIX “heap-only” mod_alloc_ctx and sof_ctx_* helpers for API parity.
src/include/sof/lib/vregion.hSimplifies non-vregions stubs (no dummy allocation; vregion ops return NULL).
src/include/sof/lib/dai-zephyr.hRemoves now-deleted sof/ctx_alloc.h include.
src/include/sof/audio/component.hRemoves now-deleted sof/ctx_alloc.h include.
src/include/sof/ctx_alloc.hDeletes the standalone ctx allocation header (API moved to rtos/alloc.h).
src/include/ipc4/pipeline.hReplaces interim/lifetime/shared fields with heap_bytes in IPC4 pipeline mem data.
src/include/ipc4/module.hReplaces interim/lifetime/shared fields with heap_bytes in IPC4 DP mem data.
src/ipc/ipc4/helper.cUpdates IPC4 pipeline ext object decode log to match heap_bytes.
src/audio/module_adapter/module_adapter_ipc4.cUpdates IPC4 module ext init decode log to match heap_bytes.
src/audio/module_adapter/module/generic.cDrops sof/ctx_alloc.h include (uses moved API).
src/audio/buffers/ring_buffer.cDrops sof/ctx_alloc.h include (uses moved API).
src/audio/buffers/comp_buffer.cDrops sof/ctx_alloc.h include (uses moved API).

struct k_heap *sof_sys_heap_get(void);
struct k_heap *sof_sys_user_heap_get(void);

/* Posix version of struct mod_alloc_ctx without vregion support */
lyakh
lyakh previously requested changes Jun 4, 2026

@lyakhlyakh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

use-counts are needed

@jsarha
jsarhaforce-pushed the only_heap_size_attribute branch from c00d82c to c3abdd3CompareJune 4, 2026 21:53
@jsarhajsarha changed the title [DNM] Only heap size attributeOnly heap size attributeJun 4, 2026
@jsarha

Copy link
Copy Markdown
ContributorAuthor

There really is no reason to keep the [DNM] tag. This is really only back stepping one unnecessary change that has not been released in any SOF release.

@lyakh
lyakh dismissed their stale reviewJune 5, 2026 06:12

misunderstanding on my part

@lyakh

lyakh commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

@jsarha yep, sorry again - was too quick reacting to the use-count removal yesterday. You now have 2 PRs with some common commits - this one and #10831. Looks like this one supersedes the the latter. Let me approve both then

Simplify the IPC4 memory data structs by replacing separate
interim_heap_bytes, lifetime_heap_bytes, and shared_bytes fields with a
single heap_bytes field, matching the Linux driver side changes.
Affects both ipc4_module_init_ext_obj_dp_data and
ipc4_pipeline_ext_obj_mem_data structs, and their corresponding log
messages.
Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha
jsarhaforce-pushed the only_heap_size_attribute branch from c3abdd3 to 4cbbf9cCompareJune 8, 2026 08:03
@jsarha

Copy link
Copy Markdown
ContributorAuthor

Rebased.

@lgirdwood

Copy link
Copy Markdown
Member

@jsarha can you check CI, thanks !

@jsarha

Copy link
Copy Markdown
ContributorAuthor

SOFCI TEST

@kv2019i
kv2019i merged commit 60283dc into thesofproject:mainJun 9, 2026
45 checks passed
Sign up for freeto 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

@jsarha@lyakh@lgirdwood@kv2019i