Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPL: correctly propagate timers with the same description #12820

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Framework/Core/src/DeviceSpecHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,12 @@ void DeviceSpecHelpers::processOutEdgeActions(ConfigContext const& configContext
.channel = channel.name,
.policy = forwardPolicyPtr,
};
// In case we have a timer, the data it creates should be
// forwarded as a timeframe to the next device, so that
// we have synchronization.
if (route.matcher.lifetime == Lifetime::Timer) {
route.matcher.lifetime = Lifetime::Timeframe;
}
device.forwards.emplace_back(route);
}
};
Expand Down Expand Up @@ -923,6 +929,7 @@ void DeviceSpecHelpers::processInEdgeActions(std::vector<DeviceSpec>& devices,
auto appendInputRouteToDestDeviceChannel = [&devices, &logicalEdges, &workflow](size_t ei, size_t di, size_t ci) {
auto const& edge = logicalEdges[ei];
auto const& consumer = workflow[edge.consumer];
auto const& producer = workflow[edge.producer];
auto& consumerDevice = devices[di];

auto const& inputSpec = consumer.inputs[edge.consumerInputIndex];
Expand All @@ -949,6 +956,19 @@ void DeviceSpecHelpers::processInEdgeActions(std::vector<DeviceSpec>& devices,
}
}

// In case we add a new route to the device, we remap any
// Lifetime::Timer to Lifetime::Timeframe, so that we can
// synchronize the devices without creating a new timer.
if (edge.isForward && route.matcher.lifetime == Lifetime::Timer) {
LOGP(warn,
"Warning: Forwarding timer {} from {} to a {} as both requested it."
" If this is undesired, please make sure to use two different data matchers for their InputSpec.",
DataSpecUtils::describe(route.matcher).c_str(),
producer.name.c_str(),
consumer.name.c_str());
route.matcher.lifetime = Lifetime::Timeframe;
}

consumerDevice.inputs.push_back(route);
};

Expand Down
Loading