Skip to content

Commit cd88b27

Browse files
test
test
1 parent 1c4790f commit cd88b27

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Pipeline 2.0 - proposal, RFC
2+
****************************
3+
4+
This document describes a set of architecture changes known as “pipeline 2.0”.
5+
The purpose of the changes is to make the pipeline:
6+
7+
- more flexible
8+
- more optimal
9+
- more multi-core friendly
10+
- better fit to IPC4 (IPC3 backward compatibility must be maintained)
11+
- Implementation goal: try to keep as much common ipc3/4 core as possible.
12+
13+
initial headsup is here: https://github.com/thesofproject/sof/issues/7261,
14+
15+
previous version of the document here: https://github.com/orgs/thesofproject/discussions/8645
16+
17+
18+
some of the changes have already been implemented, but with a lot of workarounds i.e. in DP processing.
19+
20+
Module scheduling
21+
-----------------
22+
23+
Low Latency (LL) scheduling type
24+
=================================
25+
26+
All LL modules will be called every 1ms, one-by-one, in a context of a single high-priority worker thread, staring from the first data producer to the last data consumer. All LL modules working on a single core must finish processing within 1ms and must process data in 1ms chunks. The latency of a complete modules chain (when all modules are on the same core) is 1ms.
27+
28+
**2.0 new:** Each module should consume all available data from the input buffer(s), there must not be any data left in input buffer. There are exceptions: if a module has certain needs to keep data in buffers between cycles (like ASRC module), it may request it at binding time. In that case binding code must create a buffer that fulfill this requirement.
29+
30+
***2.0 new***: Modules located on different cores may be freely bound and exchange data cross-core, even in case of LL-LL connection but 1) each core-cross bind will add 1ms latency to processing 2) there are certain limitations described later.
31+
32+
Data Processing (DP) scheduling type (partially 2.0 new)
33+
============================================================
34+
35+
Each module works in its own preemptible thread context, with lower priority than LL. Each of DP module’s thread has the same priority. If there are more than one module ready, the scheduler will choose a module that have the closest deadline, where a deadline is the last moment when a following module will have to start processing. Modules will be scheduled for processing when they have enough data for processing at all inputs and enough space to store results on all outputs.
36+
37+
Current limitation/simplification: DP module must be surrounded by LL modules, there’s no possibility to connect DP to DP. DP to DP binding and proper deadline calculation is a complex task will be introduced later.
38+
39+
A DP module may be located at different core that modules bound to it, there’s no difference in processing or latency.
40+
41+
Sink/src interface
42+
======================
43+
44+
Sink/src API is an interface for data flow between bound modules. It was introduced some time ago.
45+
The main principle of modules is to process audio data. To do it, a typical module needs a source to get data from and a sink to send a processed data to. In current pipeline there’s only one type of data flow, using comp_buffer/audio_stream structures and surrounding procedures.
46+
Pipeline 2.0 introduces an API that allows flexibility of data flow – a sink / source API.
47+
48+
There are 2 sides of sink/source API:
49+
50+
- **An API provider**, typically a buffer or (2.0 new) a module like DAI - a provider of sink/source api is an entity implementing all required API methods and providing a ready-to-use pointers to data to be processed / buffer to store processed data.
51+
52+
It is up to the provider to take care of buffer management, avoiding conflicts, taking care of cache coherency (if needed), etc. Sink/source providers may have their properties and limitations – like DAI may not be able to provide data to other cores, etc. See following chapters for details
53+
54+
- **An API user**, typically a processing module. A user of sink/source API is an entity that simply call API methods and get a ready-to-use pointers to data for processing / buffer to store results. Api user does not need to do any extra operations with data, like taking care of cache coherency, it can just simply use provided pointers. It is up to the pipeline code to use a proper api provider. See following chapters for details.
55+
56+
Sink/Src naming convention: **always look from the API user (not API provider) point of view**
57+
58+
- source API is a **data source** from the point of view of the **user** of source API
59+
- source API is a **data destination** from the point of view of the **provider** of source API
60+
- sink API is a **data destination** from the point of view of the **user** of sink API
61+
- sink API is a **data source** from the point of view of the **provider** of sink API
62+
63+
**(2.0 new)** In typical case a user of API is a **processing module**, a provider is **a buffer**, but there are other possibilities. If a module – for any reason – need to have an internal data buffer, it may simply optimize the flow by exposing it to the others by providing sink/src API. Typical example of such module is DAI, that needs to have an internal buffer for DMA and may provide data to next module directly, without using additional buffer in the middle.
64+
65+
*Currently, however, there’s an optimalization in the code – DAI may use a buffer between itself and next module for its own purposes, but it is an optimalization trick/hack. Sink/Src API allows to do it in natural and flexible way.*
66+
67+
Another example of module providing sink interface may be a mixout, accepting one stream at input, keeping data in an internal buffer, and sending them out to several other modules (identical copies) by providing several instances of source API and exposing the same data buffer to several receivers. Also a unique pair mixin-mixout may use sink/src API to expose their internal buffers to each other.
68+
69+
Module binding
70+
---------------
71+
72+
There may be 3 kinds of bindings:
73+
74+
- entity using sink/source to entity using sink/source
75+
- **(2.0 new)** direct connection entity exposing sink/source to entity using sink/source
76+
- **(2.0 new)** entity exposing sink/source to entity exposing sink/source
77+
78+
Entity using sink/source to entity using sink/source
79+
========================================================
80+
Typically, a module a module. This is the most natural way of binding (at current code - the only way), requires a buffer in between:
81+
82+

0 commit comments

Comments
 (0)