Skip to content

Conversation

@lyakh
Copy link
Collaborator

@lyakh lyakh commented Jan 30, 2026

Trace context isn't used when building LLEXT, move it to monolithic build part. In many cases this eliminates the entire module's .data section.

Trace context isn't used when building LLEXT, move it to monolithic
build part. In many cases this eliminates the entire module's .data
section.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Copy link

Copilot AI left a comment

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 optimizes memory usage in LLEXT (Loadable EXTensions) builds by moving trace context declarations from global scope to monolithic build sections. The trace contexts are only needed when building modules directly into the base firmware, not when building loadable extensions.

Changes:

  • Removed global DECLARE_TR_CTX declarations from 38 audio module files
  • Re-added DECLARE_TR_CTX declarations within #else blocks (non-LLEXT/monolithic builds) where DECLARE_MODULE_ADAPTER is used
  • Removed EXPORT_SYMBOL(tflm_tr) from tensorflow module as it's no longer globally accessible

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/debug/tester/tester.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/up_down_mixer/up_down_mixer.c Moved DECLARE_TR_CTX to end of file before DECLARE_MODULE_ADAPTER
src/audio/tone/tone-ipc4.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/tone/tone-ipc3.c Moved DECLARE_TR_CTX before comp_driver definition (no LLEXT support)
src/audio/tensorflow/tflm-classify.c Removed DECLARE_TR_CTX and EXPORT_SYMBOL(tflm_tr), re-added in monolithic section
src/audio/template/template.c Moved DECLARE_TR_CTX to monolithic build section with explanatory comment
src/audio/tdfb/tdfb.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/stft_process/stft_process.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/sound_dose/sound_dose.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/smart_amp/smart_amp.c Moved DECLARE_TR_CTX to end of file before DECLARE_MODULE_ADAPTER
src/audio/selector/selector.c Moved DECLARE_TR_CTX declarations for both IPC3 and IPC4 sections appropriately
src/audio/multiband_drc/multiband_drc.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/module_adapter/module/waves/waves.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/module_adapter/module/passthrough.c Moved DECLARE_TR_CTX to end of file before DECLARE_MODULE_ADAPTER
src/audio/module_adapter/module/modules.c Removed DECLARE_TR_CTX (not needed as no DECLARE_MODULE_ADAPTER)
src/audio/module_adapter/module/dolby/dax.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/module_adapter/module/cadence.c Moved DECLARE_TR_CTX to end of file before DECLARE_MODULE_ADAPTER
src/audio/mixin_mixout/mixin_mixout.c Moved both mixin_tr and mixout_tr DECLARE_TR_CTX to monolithic build section
src/audio/mixer/mixer.c Moved DECLARE_TR_CTX to end of file before DECLARE_MODULE_ADAPTER
src/audio/mfcc/mfcc.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/level_multiplier/level_multiplier.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/kpb.c Moved DECLARE_TR_CTX before comp_driver definition
src/audio/igo_nr/igo_nr.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/host-zephyr.c Moved DECLARE_TR_CTX before comp_driver definition
src/audio/host-legacy.c Moved DECLARE_TR_CTX before comp_driver definition
src/audio/google/google_rtc_audio_processing.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/google/google_hotword_detect.c Moved DECLARE_TR_CTX before comp_driver definition
src/audio/google/google_ctc_audio_processing.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/eq_iir/eq_iir.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/eq_fir/eq_fir.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/dcblock/dcblock.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/dai-zephyr.c Moved DECLARE_TR_CTX before comp_driver definition
src/audio/dai-legacy.c Moved DECLARE_TR_CTX before comp_driver definition
src/audio/crossover/crossover.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/copier/copier_ipcgtw.c Removed DECLARE_TR_CTX (not needed as no DECLARE_MODULE_ADAPTER)
src/audio/copier/copier.c Moved DECLARE_TR_CTX before DECLARE_MODULE_ADAPTER
src/audio/codec/dts/dts.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO
src/audio/aria/aria.c Moved DECLARE_TR_CTX to monolithic build section after SOF_LLEXT_BUILDINFO

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant