From ad8d1142a7c251852dd7fff8e48d4a929d37b3b3 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 20 Jun 2022 15:03:38 -0700 Subject: [PATCH 1/8] Document modular schedulers. --- .../en/reference/Target Language Details.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index ccb7c7ebf..3621fb1a9 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2673,6 +2673,23 @@ Note that when building with a release profile (i.e., target property `build-typ +
+ +## Scheduler Target Property + +The `scheduler` target property is used to select the scheduler used by the C runtime. This scheduler determines the order in which reactions are processed. It also assigns reactions to user-level threads and can thereby influence the assignment of reactions to processors. + +Because the C runtime scheduler operates at a higher level of abstraction than the OS, none of the scheduling policies that we currently support allow preemption; furthermore, they do not control migration of threads between processors. + +The following schedulers are available: + +- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines; however, the tag of a reaction will still take precedence over its deadline in determining execution order. Reactions with no explicit deadline implicitly have an infinitely late deadline. +- `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior beyond that it maintains the deterministic semantics of Lingua Franca. This allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. +- `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. In exchange, it can accomplish good performance on iterative workloads involving reactions that execute too quickly to justify the degree of automatic parallelization that other schedulers offer. +- `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it includes an optimization called chain ID that is currently disabled. This scheduler should not be used in practical applications. + +
+ [comment]: <> (================= NEW SECTION =====================) ## Target Implementation Details From b1cb1ad29e8a05793e2aae57358b691f01cc3dff Mon Sep 17 00:00:00 2001 From: Peter Donovan <33707478+petervdonovan@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:42:11 -0700 Subject: [PATCH 2/8] Update packages/documentation/copy/en/reference/Target Language Details.md Co-authored-by: Soroush Bateni --- .../documentation/copy/en/reference/Target Language Details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index 3621fb1a9..41985fecc 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2677,7 +2677,7 @@ Note that when building with a release profile (i.e., target property `build-typ ## Scheduler Target Property -The `scheduler` target property is used to select the scheduler used by the C runtime. This scheduler determines the order in which reactions are processed. It also assigns reactions to user-level threads and can thereby influence the assignment of reactions to processors. +The `scheduler` target property is used to select the scheduler used by the C runtime. This scheduler determines the exact order in which reactions are processed, as long as the order complies with the deterministic semantics of Lingua Franca. It also assigns reactions to user-level threads and can thereby influence the assignment of reactions to processors. Because the C runtime scheduler operates at a higher level of abstraction than the OS, none of the scheduling policies that we currently support allow preemption; furthermore, they do not control migration of threads between processors. From 8586ab0fa18fb657f6d1352b2f84271438368482 Mon Sep 17 00:00:00 2001 From: Peter Donovan <33707478+petervdonovan@users.noreply.github.com> Date: Mon, 20 Jun 2022 15:42:42 -0700 Subject: [PATCH 3/8] Update packages/documentation/copy/en/reference/Target Language Details.md Co-authored-by: Soroush Bateni --- .../documentation/copy/en/reference/Target Language Details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index 41985fecc..842135cf1 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2673,7 +2673,7 @@ Note that when building with a release profile (i.e., target property `build-typ -
+
## Scheduler Target Property From bb3bd988a3a86e8fddae6d812d6dafaa1d92126f Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 20 Jun 2022 16:10:51 -0700 Subject: [PATCH 4/8] Adjust wording according to code review. --- .../copy/en/reference/Target Language Details.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index 842135cf1..700d451aa 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2684,9 +2684,9 @@ Because the C runtime scheduler operates at a higher level of abstraction than t The following schedulers are available: - `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines; however, the tag of a reaction will still take precedence over its deadline in determining execution order. Reactions with no explicit deadline implicitly have an infinitely late deadline. -- `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior beyond that it maintains the deterministic semantics of Lingua Franca. This allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. -- `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. In exchange, it can accomplish good performance on iterative workloads involving reactions that execute too quickly to justify the degree of automatic parallelization that other schedulers offer. -- `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it includes an optimization called chain ID that is currently disabled. This scheduler should not be used in practical applications. +- `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior, and this allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. +- `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. It performs experiments and measures execution times at runtime to determine the degree of exploitable parallelism in various parts of the program. This lets it automate judgments which are made more naively by the other schedulers and which are typically made by the programmer in general-purpose languages. +- `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it is designed for an optimization called chain ID that is described on page 92 [here](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2020/EECS-2020-235.pdf). This optimization is currently disabled because it is not yet fully developed, so we advise against the use of this scheduler in practical applications.
From 0c7baa5d3ef72cf0f60af3031f1296fd889302a1 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 20 Jun 2022 16:27:39 -0700 Subject: [PATCH 5/8] Rewrite GEDF_NP description. --- .../documentation/copy/en/reference/Target Language Details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index 700d451aa..6adf4a367 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2683,7 +2683,7 @@ Because the C runtime scheduler operates at a higher level of abstraction than t The following schedulers are available: -- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It guarantees that in the execution of any given tag, reactions with earlier deadlines are executed before reactions with later deadlines; however, the tag of a reaction will still take precedence over its deadline in determining execution order. Reactions with no explicit deadline implicitly have an infinitely late deadline. +- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It assigns _levels_ to reactions. The level of a reaction _r_ is the length of the longest chain of causally dependent reactions that are upstream of _r_. The `GEDF_NP` scheduler guarantees that for any pair of reactions _r_ and _s_ that have the same level and are triggered at the same tag, if the deadline of _r_ is earlier than the deadline of _s_, the execution of _r_ will never begin later than the execution of _s_. Reactions with no explicit deadline implicitly have an infinitely late deadline. - `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior, and this allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. - `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. It performs experiments and measures execution times at runtime to determine the degree of exploitable parallelism in various parts of the program. This lets it automate judgments which are made more naively by the other schedulers and which are typically made by the programmer in general-purpose languages. - `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it is designed for an optimization called chain ID that is described on page 92 [here](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2020/EECS-2020-235.pdf). This optimization is currently disabled because it is not yet fully developed, so we advise against the use of this scheduler in practical applications. From 86a4e1b9e2d8d83aec504988794c939800da8c41 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 20 Jun 2022 17:05:51 -0700 Subject: [PATCH 6/8] Apply suggestion from Soroush. --- .../documentation/copy/en/reference/Target Language Details.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index 6adf4a367..ced63442d 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2683,7 +2683,7 @@ Because the C runtime scheduler operates at a higher level of abstraction than t The following schedulers are available: -- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. It assigns _levels_ to reactions. The level of a reaction _r_ is the length of the longest chain of causally dependent reactions that are upstream of _r_. The `GEDF_NP` scheduler guarantees that for any pair of reactions _r_ and _s_ that have the same level and are triggered at the same tag, if the deadline of _r_ is earlier than the deadline of _s_, the execution of _r_ will never begin later than the execution of _s_. Reactions with no explicit deadline implicitly have an infinitely late deadline. +- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. Whenever the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions at a particular tag, this scheduler will prioritize the reaction with the earliest deadline to run first (but with the limitation that reaction executions are non-preemptive). Reactions with no explicit deadline implicitly have an infinitely late deadline. - `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior, and this allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. - `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. It performs experiments and measures execution times at runtime to determine the degree of exploitable parallelism in various parts of the program. This lets it automate judgments which are made more naively by the other schedulers and which are typically made by the programmer in general-purpose languages. - `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it is designed for an optimization called chain ID that is described on page 92 [here](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2020/EECS-2020-235.pdf). This optimization is currently disabled because it is not yet fully developed, so we advise against the use of this scheduler in practical applications. From fab458d5cd1c7e9bb3d04039be885f45d806ab93 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 20 Jun 2022 17:28:05 -0700 Subject: [PATCH 7/8] Revise GEDF_NP description further. --- .../copy/en/reference/Target Language Details.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index ced63442d..590892ce2 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2681,9 +2681,11 @@ The `scheduler` target property is used to select the scheduler used by the C ru Because the C runtime scheduler operates at a higher level of abstraction than the OS, none of the scheduling policies that we currently support allow preemption; furthermore, they do not control migration of threads between processors. +Another limitation of these schedulers is that they are constrained to process the reaction graph breadth-first. We define the _level_ of a reaction _r_ to be the length of the longest chain of causally dependent reactions that are all (causally) upstream of _r_. Current LF schedulers process one level of reactions at a time, but this constraint is more restrictive than necessary to comply with Lingua Franca semantics and is notable only for its effect on execution times. + The following schedulers are available: -- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. Whenever the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions at a particular tag, this scheduler will prioritize the reaction with the earliest deadline to run first (but with the limitation that reaction executions are non-preemptive). Reactions with no explicit deadline implicitly have an infinitely late deadline. +- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. Whenever the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions at a particular tag, this scheduler will prioritize the reaction with the earliest deadline to run first (but with the limitations that reaction executions are non-preemptive and that reactions are processed in level order). Reactions with no explicit deadline implicitly have an infinitely late deadline. - `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior, and this allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. - `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. It performs experiments and measures execution times at runtime to determine the degree of exploitable parallelism in various parts of the program. This lets it automate judgments which are made more naively by the other schedulers and which are typically made by the programmer in general-purpose languages. - `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it is designed for an optimization called chain ID that is described on page 92 [here](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2020/EECS-2020-235.pdf). This optimization is currently disabled because it is not yet fully developed, so we advise against the use of this scheduler in practical applications. From 411418e160be10dfacaac312ca6136dd9d33f078 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Mon, 20 Jun 2022 17:34:36 -0700 Subject: [PATCH 8/8] Revise GEDF_NP description further. --- .../copy/en/reference/Target Language Details.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/documentation/copy/en/reference/Target Language Details.md b/packages/documentation/copy/en/reference/Target Language Details.md index 590892ce2..dcbf8a9fc 100644 --- a/packages/documentation/copy/en/reference/Target Language Details.md +++ b/packages/documentation/copy/en/reference/Target Language Details.md @@ -2681,11 +2681,11 @@ The `scheduler` target property is used to select the scheduler used by the C ru Because the C runtime scheduler operates at a higher level of abstraction than the OS, none of the scheduling policies that we currently support allow preemption; furthermore, they do not control migration of threads between processors. -Another limitation of these schedulers is that they are constrained to process the reaction graph breadth-first. We define the _level_ of a reaction _r_ to be the length of the longest chain of causally dependent reactions that are all (causally) upstream of _r_. Current LF schedulers process one level of reactions at a time, but this constraint is more restrictive than necessary to comply with Lingua Franca semantics and is notable only for its effect on execution times. +Another limitation of these schedulers is that they are constrained to process the reaction graph breadth-first. We define the _level_ of a reaction _r_ to be the length of the longest chain of causally dependent reactions that are all (causally) upstream of _r_. Current LF schedulers process one level of reactions at a time, but this constraint is more restrictive than necessary to implement Lingua Franca's semantics and is notable only for its effect on execution times. The following schedulers are available: -- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. Whenever the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions at a particular tag, this scheduler will prioritize the reaction with the earliest deadline to run first (but with the limitations that reaction executions are non-preemptive and that reactions are processed in level order). Reactions with no explicit deadline implicitly have an infinitely late deadline. +- `GEDF_NP` (global earliest-deadline-first): This scheduler is the default scheduler for programs that have deadlines. When the semantics of Lingua Franca allows for concurrent execution of two or more ready reactions with the same level at a particular tag, this scheduler will prioritize the reaction with the earliest deadline to run first (but with the limitation that reaction executions are non-preemptive). Reactions with no explicit deadline implicitly have an infinitely late deadline. - `NP` (non-preemptive): This scheduler is the default scheduler for programs that have no deadlines. It makes minimal guarantees about its behavior, and this allows it to include optimizations that can result in lower execution times than the GEDF_NP scheduler. - `adaptive`: This scheduler behaves similarly to the `NP` scheduler, with the additional limitation that it is designed for applications that can tolerate potentially wide variability in physical execution times. It performs experiments and measures execution times at runtime to determine the degree of exploitable parallelism in various parts of the program. This lets it automate judgments which are made more naively by the other schedulers and which are typically made by the programmer in general-purpose languages. - `GEDF_NP_CI` (global earliest-deadline-first, with chain ID): This scheduler implements the same policy as `GEDF_NP`, but it is designed for an optimization called chain ID that is described on page 92 [here](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2020/EECS-2020-235.pdf). This optimization is currently disabled because it is not yet fully developed, so we advise against the use of this scheduler in practical applications.