Skip to content

Commit

Permalink
DPL: discard timeframe in case there is nothing which needs processing
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Jan 16, 2024
1 parent b9756f4 commit 84a7e8e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Framework/Core/src/CompletionPolicyHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ CompletionPolicy CompletionPolicyHelpers::consumeWhenAll(const char* name, Compl

size_t si = 0;
bool missingSporadic = false;
bool needsProcessing = false;
size_t currentTimeslice = -1;
for (auto& input : inputs) {
assert(si < specs.size());
Expand All @@ -126,6 +127,9 @@ CompletionPolicy CompletionPolicyHelpers::consumeWhenAll(const char* name, Compl
if (dph && !TimingInfo::timesliceIsTimer(dph->startTime)) {
currentTimeslice = dph->startTime;
}
// Prepare for processing if we have at least some data, we can consume, otherwise we can Discard once
// we are sure that no more data will come.
needsProcessing |= (spec.lifetime != Lifetime::Condition);
}
}
// If some sporadic inputs are missing, we wait for them util we are sure they will not come,
Expand All @@ -136,7 +140,8 @@ CompletionPolicy CompletionPolicyHelpers::consumeWhenAll(const char* name, Compl
if (missingSporadic && currentTimeslice >= oldestPossibleTimeslice) {
return CompletionPolicy::CompletionOp::Retry;
}
return CompletionPolicy::CompletionOp::Consume;
// We only consume if we have something which needs processing.
return needsProcessing ? CompletionPolicy::CompletionOp::Consume : CompletionPolicy::CompletionOp::Discard;
};
return CompletionPolicy{name, matcher, callback};
}
Expand Down

0 comments on commit 84a7e8e

Please sign in to comment.