dp: Eearliest deadline first scheduling policy #8262
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a Earlier Deadline First scheduling policy for DP processing
currently there's a limitation - DP module must be surrounded by LL modules.
it simplifies algorithm - there's no need to browse through DP chains calculating
deadlines for each module in function of all modules execution status.
Now is simple - modules deadline is its start + tick time.
example:
Lets assume we do have a pipeline:
LL1 -> DP1 -> LL2 -> DP2 -> LL3 -> DP3 -> LL4
all LLs starts in 1ms tick
for simplification lets assume
DP1 - starts every 1ms, needs 0.5ms to finish processing
DP2 - starts every 2ms, needs 0.6ms to finish processing
DP3 - starts every 10ms, needs 0.3ms to finish processing
TICK0
only LL1 is ready to run
LL1 processing (producing data chunk for DP1)
TICK1
LL1 is ready to run
DP1 is ready tu run (has data from LL1) set deadline to TICK2
LL1 processing (producing second data chunk for DP1)
DP1 processing for 0.5ms (consuming first data chunk, producing data chunk for LL2)
CPU is idle for 0.5ms
TICK2
LL1 is ready to run
DP1 is ready tu run set deadline to TICK3
LL2 is ready to run
LL1 processing (producing data chunk for DP1)
LL2 processing (producing 50% data chunk for DP2)
DP1 processing for 0.5ms (producing data chunk for LL2)
CPU is idle for 0.5ms
TICK3
LL1 is ready to run
DP1 is ready tu run set deadline to TICK4
LL2 is ready to run
LL1 processing (producing data chunk for DP1)
LL2 processing (producing rest of data chunk for DP2)
DP1 processing for 0.5ms (producing data chunk for LL2)
CPU is idle for 0.5ms
TICK4
LL1 is ready to run
DP1 is ready tu run set deadline to TICK5
LL2 is ready to run
DP2 is ready to run set deadline to TICK6
LL1 processing (producing data chunk for DP1)
LL2 processing (producing 50% of second data chunk for DP2)
DP1 processing for 0.5ms (producing data chunk for LL2)
DP2 processing for 0.5ms (no data produced as DP2 has 0.1ms to go)
100% CPU used
TICK5
LL1 is ready to run
DP1 is ready tu run set deadline to TICK6
LL2 is ready to run
DP2 is in progress, deadline is set to TICK6
LL1 processing (producing data chunk for DP1)
LL2 processing (producing rest of second data chunk for DP2)
DP1 processing for 0.5ms (producing data chunk for LL2)
DP2 processing for 0.1ms (producing TWO data chunks for LL3)
CPU is idle for 0.4ms (60% used)
TICK6
LL1 is ready to run
DP1 is ready tu run set deadline to TICK7
LL2 is ready to run
DP2 is ready to run set deadline to TICK8
LL3 is ready to run
LL1 processing (producing data chunk for DP1)
LL2 processing (producing 50% of second data chunk for DP2)
LL3 processing (producing 10% of first data chunk for DP3)
DP1 processing for 0.5ms (producing data chunk for LL2)
DP2 processing for 0.5ms (no data produced as DP2 has 0.1ms to go)
100% CPU used
(........ 9 more cycles - LL3 procuces 100% of data for DP3......)
TICK15
LL1 is ready to run
DP1 is ready tu run set deadline to TICK16
LL2 is ready to run
DP2 is ready to run set deadline to TICK17
LL3 is ready to run
DP3 is ready to run set deadline to TICK25
LL1 processing (producing data chunk for DP1)
LL2 processing (producing 50% of data chunk for DP2)
LL3 processing (producing 10% of second data chunk for DP3)
DP1 processing for 0.5ms (producing data chunk for LL2)
DP2 processing for 0.5ms (no data produced as DP2 has 0.1ms to go)
100% CPU used -
!!! note that DP3 is ready but has no chance to get CPU in this cycle
TICK16
LL1 is ready to run set deadline to TICK17
DP1 is ready tu run
LL2 is ready to run
DP2 is in progress, deadline is set to TICK17
LL3 is ready to run
DP3 is in progress, deadline is set to TICK25
LL1 processing (producing data chunk for DP1)
LL2 processing (producing rest of data chunk for DP2)
LL3 processing (producing 10% of second data chunk for DP3)
DP1 processing for 0.5ms (producing data chunk for LL2)
DP2 processing for 0.1ms (producing data)
DP3 processing for 0.2ms (producing 10 data chunks for LL4)
90% CPU used
TICK17
LL1 is ready to run
DP1 is ready tu run
LL2 is ready to run
DP2 is ready to run
LL3 is ready to run
LL4 is ready to run
!! NOTE that DP3 is not ready - it will be ready again in TICK25
LL1 processing (producing data chunk for DP1)
LL2 processing (producing rest of data chunk for DP2)
LL3 processing (producing next 10% of second data chunk for DP3)
LL4 processing (consuming 10% of data prepared by DP3)
DP1 processing for 0.5ms (producing data chunk for LL2)
DP2 processing for 0.5ms (no data produced as DP2 has 0.1ms to go)
100% CPU used
Now - pipeline is in stable state, CPU used almost in 100% (it would be 100% if DP3
needed 1.2ms for processing - but the example would be too complicated)