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

Use the NP scheduler when deadlines are present #2442

Merged
merged 2 commits into from
Nov 30, 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
27 changes: 0 additions & 27 deletions core/src/main/java/org/lflang/generator/c/CGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
import org.lflang.target.property.TracingProperty;
import org.lflang.target.property.WorkersProperty;
import org.lflang.target.property.type.PlatformType.Platform;
import org.lflang.target.property.type.SchedulerType.Scheduler;
import org.lflang.util.ArduinoUtil;
import org.lflang.util.FileUtil;
import org.lflang.util.FlexPRETUtil;
Expand Down Expand Up @@ -741,31 +740,6 @@ else if (term.getParameter() != null)
return result.toString();
}

/** Set the scheduler type in the target config as needed. */
private void pickScheduler() {
// Don't use a scheduler that does not prioritize reactions based on deadlines
// if the program contains a deadline (handler). Use the GEDF_NP scheduler instead.
if (!targetConfig.get(SchedulerProperty.INSTANCE).prioritizesDeadline()) {
// Check if a deadline is assigned to any reaction
if (hasDeadlines(reactors)) {
if (!targetConfig.isSet(SchedulerProperty.INSTANCE)) {
SchedulerProperty.INSTANCE.override(targetConfig, Scheduler.GEDF_NP);
}
}
}
}

private boolean hasDeadlines(List<Reactor> reactors) {
for (Reactor reactor : reactors) {
for (Reaction reaction : allReactions(reactor)) {
if (reaction.getDeadline() != null) {
return true;
}
}
}
return false;
}

/**
* Copy all files or directories listed in the target property {@code files}, {@code
* cmake-include}, and {@code _fed_setup} into the src-gen folder of the main .lf file
Expand Down Expand Up @@ -2033,7 +2007,6 @@ protected boolean setUpGeneralParameters() {
CompileDefinitionsProperty.INSTANCE.update(targetConfig, Map.of("MODAL_REACTORS", "TRUE"));
}
if (!targetConfig.get(SingleThreadedProperty.INSTANCE)) {
pickScheduler();
CompileDefinitionsProperty.INSTANCE.update(
targetConfig,
Map.of(
Expand Down
Loading