Skip to content

topology: validator: check IPC4 pin format compatibility - #11443

Open
ujfalusi wants to merge 8 commits into
thesofproject:mainfrom
ujfalusi:peter/pr/tplg-validator-formats-01
Open

ujfalusi wants to merge 8 commits into
thesofproject:mainfrom
ujfalusi:peter/pr/tplg-validator-formats-01

Conversation

@ujfalusi

@ujfalusi ujfalusi commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Validate format compatibility between connected IPC4 pins using explicit pin bindings, and report incompatible declared format sets. Add checks for invalid sample types and bit depths, with regression coverage. The validator checks declared format compatibility; it does not predict behavior across kernel versions or runtime format selection.

The fixed topologies all have incompatible formats on connections, like:

sof-hda-benchmark-generic.tplg: warning: F003 route
'dai-copier.HDA.Analog.capture' -> 'eqiir.5.1':
output pin 0 [48000Hz/2ch/24bit/type1] has no compatible format with
input pin 0 [48000Hz/2ch/32bit/type1]

Remove the standalone DMIC WoV target. Its KPB secondary output declares
16 kHz while the connected host copier only declares 48 kHz input
formats, which F003 reports as incompatible.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Include the sample-type bits in the selector input and playback copier
input formats. These internal connections carry 32-bit LSB integer
samples, matching the DRC and crossover FIR outputs.

Leave the external SoundWire output format unchanged.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…gateways

The generic benchmark provides its own playback and capture DAI
pipelines, but also instantiates the default component-benchmark DAI
gateways. The overlapping pipeline IDs and duplicate widget names cause
the wrong format declarations and pipeline ownership to be used.

Instantiate the default gateways only with HDA_CONFIG=none. Keep the
custom gateways for HDA_CONFIG=benchmark and document the distinction.
Verify analog playback and capture at 48 kHz in S16_LE, S24_LE and
S32_LE on a TGL HDA device with kernel 7.2.14. Both directions now run
instead of playback timing out and capture failing at pipeline start.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…arks

MFCC and MFCC-mel benchmarks configure the host copiers and processing
modules for 16 kHz, but their HDA DAI copiers inherit 48 kHz formats.
F003 reports incompatible formats on both connections to the DAIs.

Use the configured HDA playback and capture rates for both sides of the
DAI copiers, and select 16 kHz for all six MFCC benchmark variants. Keep
48 kHz defaults for other component benchmarks. The copiers convert
sample formats, not sample rates, so the HDA link must also use 16 kHz.

Document the benchmark rate and feature-data output.

Verify three-second playback and capture streams at 16 kHz for each
variant in its native S16_LE, S24_LE or S32_LE format on a TGL HDA
device with kernel 7.2.14. This checks stream operation, not MFCC
algorithm correctness. Representative unaffected benchmark binaries
remain byte-identical.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The standalone SRC-gain-mixin topology declares MSB integer samples on
internal connections whose peers declare LSB integer samples. F003
reports mismatches at both the playback and capture copiers.

Use LSB integer samples for the shared playback copier input and the
standalone capture copier output. Remove their explicit fmt_cfg
overrides so the base format classes encode the selected sample type.
Keep the SoundWire-facing formats as MSB integer.

These connections carry 32 valid bits in 32-bit containers, so sample
placement is unchanged. This corrects the format declarations rather
than an observed runtime audio failure.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
…cted rate

The HDA analog PCM advertises only 48 kHz in its rate list even when
its minimum and maximum rates are set to 96 kHz. The resulting empty
rate constraints prevent the stream from opening.

The playback gain, mixers and effects also retain 48 kHz defaults when
96 kHz is selected. Move the pre-mixer gain formats out of the mixer
control and configure the internal playback chain at the selected rate.
Allow the PCM rate list to include the configured rate while retaining
the fixed minimum and maximum constraints.

Keep the capture high-pass cutoff at 40 Hz for 96 kHz by using the
20 Hz / 48 kHz coefficients, which have the same normalized cutoff.

All nine 96 kHz development targets pass F003 with the validator in this
series. Playback and capture were tested on a TGL HDA device with S16_LE,
S24_LE and S32_LE at 96 kHz and with the production topology at 48 kHz.
The updated high-pass coefficients have not been tested on hardware.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The nocodec WebRTC test topology declares a 16-bit capture DAI output
feeding a copier configured for 32-bit input. Its VAD also declares
48 kHz formats while the following noise suppressor uses 16 kHz.

Configure the DAI output as 32-bit, matching the first module copier.
Make the VAD format rate selectable, defaulting to 48 kHz, and set it
to 16 kHz in this test topology. This preserves the existing sample
format and channel choices while aligning the connected formats.

The rebuilt topology passes F003. Hardware testing requires an SSP
nocodec loopback setup and has not been performed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 11:42

@kv2019i kv2019i 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.

Excellent, thanks!

Copilot AI 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.

🟡 Changes recommended

Removing the sole build target for sof-dmic-4ch-wov.tplg would stop production builds from generating the shared PTL/WCL WoV feature topology.

4 open issues
What changed in this PR

This PR extends SOF’s topology validator to check declared format compatibility between connected IPC4 pins, without predicting runtime format selection. It also updates topology definitions and adds regression coverage.

Changes:

  • Add pin-aware compatibility checks and sample-type/bit-depth validation.
  • Adjust HDA, SoundWire, and WebRTC topology formats and rates.
  • Document validation behavior and add unit, CLI, and integration tests.
File Description
tools/​topology/​validator/​tests/​test_rules.py Add format-validation and CLI regression cases.
tools/​topology/​validator/​tests/​test_integration.py Check SoundWire echo-reference pin compatibility.
tools/​topology/​validator/​README.md Explain format checks, severities, and limitations.
tools/​topology/​validator/​checks/​tokens.py Add T008 sample-type and bit-depth validation.
tools/​topology/​validator/​checks/​paths.py Update declared-format normalization.
tools/​topology/​validator/​checks/​ipc4.py Add F003 connected-pin compatibility checks.
tools/​topology/​topology2/​README.md Document HDA benchmark rates and filter behavior.
tools/​topology/​topology2/​production/​tplg-targets-ace3.cmake Remove the DMIC WoV production registration.
tools/​topology/​topology2/​platform/​intel/​sdw-amp-xover.conf Adjust integer sample-type declarations.
tools/​topology/​topology2/​include/​pipelines/​cavs/​mixout-gain-alh-dai-copier-playback.conf Use LSB integer input format.
tools/​topology/​topology2/​include/​components/​webrtc-vad.conf Make VAD sample rate configurable.
tools/​topology/​topology2/​development/​cavs-nocodec-webrtc-ns.conf Align VAD rate and capture output depth.
tools/​topology/​topology2/​cavs-sdw-src-gain-mixin.conf Use LSB integer output format.
tools/​topology/​topology2/​cavs-mixin-mixout-hda.conf Align component formats and rate-specific filtering.
tools/​topology/​topology2/​cavs-benchmark-hda.conf Gate default DAI pipelines and align MFCC rates.

Review effort: Balanced

Comment thread tools/topology/validator/checks/ipc4.py Outdated
if not selected and output and pin > 0 and widget.type_name in PROCESS_TYPES:
selected = [f for f in fmts if not f.get(index, 0)]
# Incomplete formats are diagnosed by T006; do not infer incompatibility.
if not selected or any(not f.get(rate) or not f.get(cfg) for f in selected):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

bits = (cfg >> 8) & 0xff
stype = (cfg >> 16) & 0xff if bits in (8, 32) else TYPE_LSB_INTEGER
stype = (cfg >> 16) & 0xff
if bits == 32 and fmt.get(depth_tok, 0) == 32 and stype == 0:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK

problem = f"valid bit depth {bits} exceeds container depth {depth}"
elif stype == 4 and (depth, bits) != (32, 32):
problem = f"float requires 32/32 bits, got {depth}/{bits}"
elif stype in (5, 6) and (depth, bits) != (8, 8):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

valid

@intel-sofci

intel-sofci commented Nov 11, 2026 •

Copy link
Copy Markdown

PR 11443: test results

Run date: 2026-11-11 15:43 UTC

Tested commit: 18727ad1226517c6a7b85f51806a37db92472b6e

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@ujfalusi
ujfalusi force-pushed the peter/pr/tplg-validator-formats-01 branch from 01872cb to 18727ad Compare November 11, 2026 14:53
Resolve route endpoints to their bound input and output pins and report
an error when declared format sets have no compatible format. Do not
infer queue allocation for unbound multi-pin endpoints or constrain
undeclared secondary copier outputs. Compare mixer outputs using the
shared format set selected by the kernel for all pins.

Check sample representations independently of compatibility
normalization and reject invalid sample types and bit depths. Treat
full-width 32-bit MSB and LSB integers as equivalent, and include
container depth when evaluating declared sample types. These checks
validate declared format compatibility, not the behavior of a
particular kernel version or runtime sample alignment.

Matching declarations do not simulate runtime selection, and
module-specific configuration can require further review. Cover pin
bindings, sample types, base topologies, and siggen echo reference with
regression tests.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ujfalusi

Copy link
Copy Markdown
Contributor Author

Changes since v1:

  • Validate compatibility between connected IPC4 pins and reject invalid sample formats.
  • Treat full-width signed integer types equivalently and skip incomplete format declarations.
  • Add validator regression coverage; leave the obsolete WoV topology removal unchanged.

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