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

Static scheduler #1830

Open
wants to merge 350 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
350 commits
Select commit Hold shift + click to select a range
171da5e
Merge verifier and static scheduler CI workflows
lsk567 Jul 28, 2023
310ef57
Commit changes to the CI file, which were missing for some reason
lsk567 Jul 28, 2023
eb57ad9
Add WIP to let @wcet pass the round trip test
lsk567 Jul 28, 2023
c353e08
Update formatter to handle new annotation syntax.
petervdonovan Jul 29, 2023
5d4f7fe
Small fix in FormattingUnitTests.java
lsk567 Jul 29, 2023
e98135a
Merge branch 'master' into static-schedule
lsk567 Jul 29, 2023
19732ff
Rename RL to EGS
lsk567 Jul 31, 2023
9e74d03
Minor comment update
lsk567 Jul 31, 2023
064f7d6
Start to work on a mocasin scheduler
lsk567 Jul 31, 2023
7acb888
Add comments
lsk567 Jul 31, 2023
44bf2d4
Rename EVM to PRET VM
lsk567 Jul 31, 2023
1d40dbc
Apply spotless
lsk567 Jul 31, 2023
6ac3727
Reduce the timeout value of ScheduleTest, so the CI does not fail due…
lsk567 Jul 31, 2023
6e98c69
WIP for generating mocasin XML SDF3 files
lsk567 Jul 31, 2023
db89415
Merge branch 'master' into static-schedule
lsk567 Aug 1, 2023
7ed4126
Do not generate DU if fast mode is on
lsk567 Aug 1, 2023
4185a15
Apply spotless
lsk567 Aug 1, 2023
667dc8a
Refactor state space explorer
lsk567 Aug 1, 2023
f4646a6
Update loopFound to loopIsFound()
lsk567 Aug 1, 2023
8d8529e
Update comments and author tags
lsk567 Aug 1, 2023
3f4f9f1
Merge branch 'master' into static-schedule
lsk567 Aug 1, 2023
6d22246
Add WIP for supporting port hierarchies in state space explorer
lsk567 Aug 1, 2023
748f71c
Add a comment about addAll()
lsk567 Aug 1, 2023
50d7899
Make the explore() function static and enforce loop finding
lsk567 Aug 2, 2023
dc95efe
Begin to support shutdown, and set the stage for supporting multiple …
lsk567 Aug 3, 2023
3aa9faf
Generate timeout scenario in the shutdown phase
lsk567 Aug 3, 2023
c14519a
Do not generate dot files if diagrams are empty.
lsk567 Aug 3, 2023
bf532aa
Add validator for the generated SDF3 XML files
lsk567 Aug 4, 2023
51d3c57
Generate actorProperties and channelProperties in SDF3 XML
lsk567 Aug 4, 2023
24381b8
Skip certain compilation steps for MOCASIN. Append postfix to XML files.
lsk567 Aug 4, 2023
d267bab
Add @wcet to TwoPhases.lf
lsk567 Aug 4, 2023
ba22c67
Merge branch 'master' into static-schedule
lsk567 Aug 6, 2023
41085fc
Fix race condition by removing the reactor_reached_stop_tag array sin…
lsk567 Aug 6, 2023
465e75f
Turn upstream and downstream fragments into lists
lsk567 Aug 7, 2023
ec6c26a
Generate labels for different phases
lsk567 Aug 7, 2023
7fdc706
Generate macros for labels
lsk567 Aug 7, 2023
9917b6b
Support branch instructions and transition guards
lsk567 Aug 8, 2023
3045863
Generate JMP for default transitions, fix linker, and apply spotless
lsk567 Aug 9, 2023
19ee103
Allow conditional branching between phases. Support shutdown triggers…
lsk567 Aug 10, 2023
e4253e6
Merge pull request #1937 from lf-lang/static-schedule-phase-jump
lsk567 Aug 10, 2023
7d3ac59
Merge branch 'master' into static-schedule
lsk567 Aug 10, 2023
df0142d
Update the dot files paths and names in EGS scheduler to align with t…
ChadliaJerad Aug 11, 2023
74c3b6c
Fix dag update from file
ChadliaJerad Aug 12, 2023
86ddc27
EGS scheduler: get, check and set workers, add colors and set partitions
ChadliaJerad Aug 12, 2023
727fa4b
Apply formatter
ChadliaJerad Aug 12, 2023
ddf34b4
Remove the static scheduler when compiling for Arduino
lsk567 Aug 13, 2023
ec43abd
Rename BASELINE to LOAD_BALANCED
lsk567 Aug 13, 2023
d5d7e45
Enable passing static scheduler on the command line
lsk567 Aug 14, 2023
0a2609d
Fix explorer bug when exploring scenario SHUTDOWN_TIMEOUT
lsk567 Aug 14, 2023
0ae9257
Remove cycle checking, as the condition might be wrong
ChadliaJerad Aug 14, 2023
0d25d90
Adjust workers number and usage when calling the EGS scheduler
ChadliaJerad Aug 14, 2023
f5d5586
Adjust formatting unit test and apply spotless
lsk567 Aug 15, 2023
6ca1e73
Merge branch 'master' into static-schedule
lsk567 Aug 15, 2023
4ef921c
Add proper union types to SchedulerDictOption
lsk567 Aug 20, 2023
44b8b2c
Check if a DAG is well-formed.
lsk567 Aug 20, 2023
b500c85
Deprecate SAC and fix race condition by using SYNC_BLOCK for synchron…
lsk567 Aug 22, 2023
5a4a2df
Bump reactor-c
lsk567 Aug 22, 2023
7406bc6
Merge branch 'master' into static-schedule
lsk567 Aug 22, 2023
5a8f228
Update to new PRET VM instruction format for C target
erlingrj Sep 23, 2023
c7b9443
Add WIP for mocasin
lsk567 Sep 25, 2023
b3d0600
Bump reactor-c
lsk567 Sep 25, 2023
cd71f4b
Merge branch 'master' into static-schedule
lsk567 Sep 25, 2023
e25f967
Merge branch 'static-schedule' into static-update-instr
erlingrj Sep 25, 2023
d155bc1
Bump reactor-C
erlingrj Sep 25, 2023
7052656
Merge pull request #2022 from lf-lang/static-update-instr
erlingrj Sep 25, 2023
73b9c7e
Support mocasin
lsk567 Oct 2, 2023
c96a9f0
Update mocasin note
lsk567 Oct 2, 2023
f7a4c66
Add copy methods and use copies when inserting guards to fix the labe…
lsk567 Oct 2, 2023
1025d70
Merge branch 'static-schedule' into static-schedule-mocasin
lsk567 Oct 3, 2023
905893d
Fix buffer overflow, remove unused instructions, apply spotless
lsk567 Oct 5, 2023
6b4daa6
Merge branch 'master' into static-schedule
lsk567 Oct 5, 2023
b29a208
Start to work on physical actions
lsk567 Oct 6, 2023
b04aa57
Support basic polling interpretation of physical actions
lsk567 Oct 9, 2023
038b4b2
Fix bug about missing dependencies across priorities
lsk567 Oct 10, 2023
20a1555
Set hyperperiod in the merged DAG.
lsk567 Oct 10, 2023
73f6c29
Make triggers explicit in the schedule
lsk567 Oct 12, 2023
295b7a6
Finish generating BEQ guards and JAL instructions when guards are not…
lsk567 Oct 12, 2023
3b1df57
Make sure state space explorer does not involve physical actions duri…
lsk567 Oct 12, 2023
ff8c54d
Use the environment struct to pass necessary information to check the…
lsk567 Oct 16, 2023
9474535
Get a simple test to work
lsk567 Oct 16, 2023
502f83b
Add a test case for connections
lsk567 Oct 18, 2023
5c553d7
Fix of the partioned dag partitions
ChadliaJerad Oct 26, 2023
0513c6e
Add WIP
lsk567 Oct 27, 2023
cb6f754
Make code generator accept canonical DAGs
lsk567 Oct 27, 2023
314c5c6
Redirect EGS outputs to stdout and stderr
lsk567 Oct 28, 2023
f2d8429
Add completion deadline inference logic. Need major refactoring later.
lsk567 Oct 29, 2023
21a91cf
Make the shutdown phase's hyperperiod max long
lsk567 Oct 29, 2023
45d6318
Make the last SYNC node in acyclic dag have max long time
lsk567 Oct 29, 2023
3ebc728
FiX to the reverse edge generation in the EGS scheduler
ChadliaJerad Oct 29, 2023
492db67
Revert "Add completion deadline inference logic. Need major refactori…
lsk567 Oct 29, 2023
3d650e3
Turn wcet annotation into a comma separated list
lsk567 Oct 30, 2023
407e1a9
Let Mocasin accept a list of wcets, the first is A7, the second is A15
lsk567 Oct 30, 2023
c7aa5ca
Merge branch 'static-schedule-wcets' into static-schedule
lsk567 Oct 30, 2023
7e18dd5
Assume EGS installed. Fix upstream sync node bug.
lsk567 Nov 12, 2023
48b3819
Apply spotless
lsk567 Nov 12, 2023
649bccf
Add wcet to ThreePhases
lsk567 Nov 15, 2023
323ed2a
Bump reactor-c
lsk567 Nov 15, 2023
a4a858c
Merge branch 'master' into static-schedule
lsk567 Nov 15, 2023
f83daa7
Apply spotless
lsk567 Nov 16, 2023
1e236c9
Update integration test
lsk567 Nov 16, 2023
bc915fb
Parsing nested dictionary
lsk567 Nov 16, 2023
f7595ba
Merge branch 'master' into static-schedule
lsk567 Nov 20, 2023
222ad8c
Merge branch 'scheduler-and-worker-fix' into static-schedule
lsk567 Nov 20, 2023
5912b90
Update lf_assert to LF_ASSERT
lsk567 Nov 20, 2023
967f46b
Bump reactor-c, fix CTriggerObjectsGenerator, update ScheduleTest
lsk567 Nov 20, 2023
74a1536
Fix mocasin property check
lsk567 Nov 20, 2023
e6dee1f
Set default static scheduler to LOAD_BALANCED
lsk567 Nov 24, 2023
e7e941b
Fix the phantom dependency problem
lsk567 Dec 4, 2023
dbf8db1
Merge branch 'master' into static-schedule
lsk567 Dec 6, 2023
d9f2407
Merge branch 'static-schedule' into static-schedule-explicit-triggers
lsk567 Dec 7, 2023
b6a01cb
Add WIP
lsk567 Dec 14, 2023
eba161a
Fix the issue of duplicating ADVIs and DUs for each reaction in the s…
lsk567 Jan 6, 2024
f4e728f
Start to generate connection management functions
lsk567 Jan 7, 2024
5fc726c
Add WIP
lsk567 Jan 7, 2024
0f6ff2b
Unify DAG generation logic for both cyclic and acyclic diagrams. Use …
lsk567 Jan 20, 2024
7020e75
Commit TODOs for record keeping
lsk567 Jan 20, 2024
8239515
Add WIP. SimpleConnection kind of works.
lsk567 Jan 20, 2024
c7be414
Make SimpleConnection test case work
lsk567 Jan 25, 2024
5445262
Update helper function names, update unit tests
lsk567 Feb 1, 2024
7ce303f
Fix excessive invocations of post connection helpers
lsk567 Feb 4, 2024
2db00e3
Use a standard helper function to add instructions, which fixes Sched…
lsk567 Feb 4, 2024
0e19505
Prune and improve comments
lsk567 Feb 11, 2024
15cece9
Organize static tests
lsk567 Feb 11, 2024
06edf6c
Bump reactor-c
lsk567 Feb 11, 2024
e9160ca
Merge branch 'master' into static-schedule
lsk567 Feb 11, 2024
212a149
Refactor static tests
lsk567 Feb 12, 2024
2cf886c
Refactor test framework, temporarily comment out the connection skipp…
lsk567 Feb 12, 2024
c8c7309
Merge branch 'master' into static-schedule
lsk567 Feb 12, 2024
fbe022e
Prune EIT from InstructionGenerator, fix the misplacement issue of pr…
lsk567 Feb 14, 2024
4e8c7e5
Perform NULL and timestamp check when getting events from the pqueue
lsk567 Feb 14, 2024
b3e210b
Use the static flag for StaticAlignment.lf
lsk567 Feb 15, 2024
28f8c24
Add WIP for attributing instructions to DAG nodes
lsk567 Feb 15, 2024
4f3f81b
Attribute connection helper EXEs to DAG nodes
lsk567 Feb 15, 2024
0b55e97
Show instructions in DOT
lsk567 Feb 15, 2024
6318f83
Technical debt: disabling cycle check in LFValidator for now since de…
lsk567 Feb 23, 2024
c94d656
Disable cycle checks, check for null token, add unsupported tests
lsk567 Feb 25, 2024
38c2038
Merge branch 'master' into static-schedule
lsk567 Feb 25, 2024
3228700
Pass reaction numbers in InstructionEXE for tracing
lsk567 Feb 29, 2024
234d856
Bump reactor-c
lsk567 Mar 4, 2024
75c694b
Fix crash by reporting warning from nowhere()
lsk567 Mar 4, 2024
2307d36
Update time fields in post-connection helpers
lsk567 Mar 6, 2024
dbda73c
Bump reactor-c
lsk567 Mar 6, 2024
6f8f4e2
Bump reactor-c
lsk567 Mar 7, 2024
d90e497
Add WIP
lsk567 Mar 10, 2024
ad9533e
Bump reactor-c
lsk567 Mar 10, 2024
08fff06
Add DAG edges based on connections, including those with delays. Coop…
lsk567 Mar 13, 2024
f05a2a0
Revert to using eventualDestinationsOrig() in dependentReactions()
lsk567 Mar 13, 2024
ca786d4
Fix connection edge generation in DAGs
lsk567 Mar 14, 2024
e29725d
Bump reactor-c
lsk567 Mar 14, 2024
3bd1022
Generate a pre-connection helper when the last port-modifying reactio…
lsk567 Mar 15, 2024
3042b78
Use a faster algorithm to remove redundant edges
lsk567 Mar 16, 2024
7ea014d
Fix pre-connection helper generation
lsk567 Mar 16, 2024
3527f02
Fix dangling pointers which can lead to undefined behaviors
lsk567 Mar 17, 2024
2feb5c7
Move connection management out of the jump-pass region
lsk567 Mar 17, 2024
f927b49
Redo 'Move connection management out of the jump-pass region' while n…
lsk567 Mar 18, 2024
7dd27f3
Bump reactor-c: Increase spin wait threshold to 100 msec
lsk567 Mar 19, 2024
23a1c50
Bump reactor-c: Use spin wait for NP for fairness
lsk567 Mar 19, 2024
c73e8d7
Bump reactor-c again: Use spin wait for NP for fairness
lsk567 Mar 19, 2024
286206f
Support dash mode
lsk567 Mar 20, 2024
35e67d7
Merge branch 'static-schedule' into static-schedule-circular-buffer
lsk567 Mar 22, 2024
8ae4b5f
Use circular buffers
lsk567 Mar 22, 2024
ca43a52
Get optimized circular buffer to work
lsk567 Mar 22, 2024
09e1344
Use function pointers to execute virtual instructions. Stop tracing a…
lsk567 Mar 23, 2024
e868224
Remove tracepoints except reaction starts and stops
lsk567 Mar 23, 2024
b1cf1a0
Optimize away zero-delay connection buffer management
lsk567 Mar 23, 2024
7beaa39
Clear is_present fields in post-connection helpers
lsk567 Mar 24, 2024
1fc56f6
Use pure spin wait in DU for evaluation
lsk567 Mar 24, 2024
cd6ec81
Disable cycle checks for now
lsk567 Mar 26, 2024
2045d6e
Allow dangling output ports
lsk567 Mar 26, 2024
c1d1be5
Add WU when the same reaction is mapped to different workers, fixing …
lsk567 Mar 29, 2024
31c01a9
Generate WUs for nodes linked by a connection but mapped to different…
lsk567 Mar 30, 2024
0758301
Use memcpy to handle more data types
lsk567 Apr 7, 2024
7929b9b
Partially support token type
lsk567 Apr 8, 2024
9399218
Add FIXME
lsk567 Apr 15, 2024
9b23a86
Refactor registers
lsk567 Apr 21, 2024
596cb7e
Fix concurrency bug after the register refactoring
lsk567 Apr 26, 2024
1a125b0
Make ScheduleTest symmetric
lsk567 Apr 26, 2024
9fa4695
Add PeepholeOptimizer and an opt that removes redundant WUs
lsk567 Apr 27, 2024
d124242
Add a test case for the WU optimization
lsk567 Apr 27, 2024
c0fa10c
Remove unused files
lsk567 Apr 27, 2024
5b5b492
Minor name change
lsk567 Apr 27, 2024
e2512de
Set up infrastructure for factoring out procedures
lsk567 Apr 29, 2024
df34fbe
Various comments and a README on optimizers
lsk567 May 1, 2024
400c561
Support multiple labels for a location, make sure a phase label is be…
lsk567 May 31, 2024
3e86b31
Fix lf_set issue and turn SimpleConnection into a proper test case
lsk567 Jun 1, 2024
d5edde5
Merge branch 'static-schedule' into static-schedule-opt
lsk567 Jun 2, 2024
c678511
Add WIP
lsk567 Jun 6, 2024
2103db5
DataTypes.lf no longer works after reverting the reactor-c commit abo…
lsk567 Jun 7, 2024
a21ef78
Linearize partitions in the load balanced scheduler
lsk567 Jun 7, 2024
fe63e9c
Check for empty behavior
lsk567 Jun 18, 2024
7228b35
Fix the incompatible conversion warning/error
lsk567 Jul 3, 2024
cebebb7
Bump reactor-c
lsk567 Aug 4, 2024
1f5a6d3
Merge branch 'static-schedule' into static-schedule-opt
lsk567 Aug 4, 2024
8f1d030
Deprecate the brittle placeholder map mechanism for handling delayed …
lsk567 Aug 14, 2024
51185b0
Remove debug prints
lsk567 Aug 14, 2024
9c3aef7
Fix equivalence class grouping by enabling relative timing for ADVI a…
lsk567 Aug 31, 2024
e3ef195
Fix DU, udpate test case
lsk567 Sep 1, 2024
7733021
Remove debug prints and prevent PeepholeOptimizer from removing labels
lsk567 Sep 1, 2024
1afcecb
Stop storing instructions inside nodes, which caused inconsistent ord…
lsk567 Sep 5, 2024
5678c6a
Bump reactor-c
lsk567 Oct 7, 2024
04fc70a
Merge branch 'master' into static-schedule-merge
lsk567 Oct 8, 2024
f10a594
Get tracing to work
lsk567 Oct 8, 2024
4fd6823
Bump reactor-c
lsk567 Oct 8, 2024
bfb3306
Bump reactor-c
lsk567 Oct 9, 2024
3610b88
Apply spotless
lsk567 Oct 10, 2024
9b81846
Add WIP
lsk567 Oct 14, 2024
e653166
Relocate the instructions to a separate folder.
lsk567 Oct 14, 2024
6b78e95
Cleanup registers and apply spotless
lsk567 Oct 15, 2024
e2e7739
Update the connection test
lsk567 Oct 16, 2024
65bc9dd
Add instructions for checking deadline violations
lsk567 Oct 17, 2024
228e809
Apply spotless
lsk567 Oct 17, 2024
310b0b4
Add a missing semicolon
lsk567 Oct 17, 2024
0381eaf
Add WIP
lsk567 Oct 19, 2024
273cbc7
Properly add dummy nodes and connect reactions with deadlines to gene…
lsk567 Oct 21, 2024
53ed930
Explicitly specify the static scheduler for StaticDeadline.lf
lsk567 Oct 21, 2024
b883b8f
Merge branch 'static-schedule-deadline' into static-schedule
lsk567 Oct 21, 2024
28a995e
Bump reactor-c
lsk567 Oct 21, 2024
58a6e93
Merge branch 'master' into static-schedule
lsk567 Oct 21, 2024
908386d
Apply spotless
lsk567 Oct 21, 2024
09d4291
Change LOAD_BALANCED to LB and static-scheduler to mapper
lsk567 Oct 22, 2024
47e0c4e
Fix the deadline encoding in DAGs
lsk567 Oct 22, 2024
0dba557
Clean up mocasin-related codegen logic
lsk567 Oct 23, 2024
12f535b
Add a deadline validator
lsk567 Oct 23, 2024
71b3fef
Fix the placeholder macro issue of EXE
lsk567 Oct 24, 2024
ec948d3
Apply spotless
lsk567 Oct 24, 2024
c556a42
Put DU after SYNC_BLOCK to reduce lag
lsk567 Nov 3, 2024
386e88b
Detect WCETs of 0 when EGS is in use and consolidate DAG validation
lsk567 Nov 7, 2024
8090701
Apply spotless
lsk567 Nov 7, 2024
f4a9608
Bump reactor-c
erlingrj Nov 8, 2024
2ec0c92
Replace ADV & ADVI with ADDs
lsk567 Nov 8, 2024
22e7ce2
Clean dead code
lsk567 Nov 8, 2024
aed46ae
Apply spotless
lsk567 Nov 8, 2024
8218088
Merge branch 'static-schedule' of github.com:lf-lang/lingua-franca in…
lsk567 Nov 8, 2024
ded2e4e
add wcets for instructions calculated by platin
tanneberger Nov 8, 2024
8d3040f
Cover all instructions on FlexPRET
erlingrj Nov 9, 2024
fc1042f
Remove ADV & ADVI
lsk567 Nov 9, 2024
58fcd92
Fix a race condition related to out-of-order execution
lsk567 Nov 11, 2024
41fef7c
Merge branch 'static-schedule' of github.com:lf-lang/lingua-franca in…
lsk567 Nov 11, 2024
ff1224a
Differentiate between DAG end node and tail node. Only DAG end node p…
lsk567 Nov 11, 2024
3380a43
Apply spotless
lsk567 Nov 11, 2024
8aabe44
Add a test case for checking large deadlines
lsk567 Nov 11, 2024
a145e33
Prevent redundant deadline SYNC nodes
lsk567 Nov 11, 2024
0cca5dc
Disable optimizers for now
lsk567 Nov 12, 2024
c17631d
Recover missing edges
lsk567 Nov 12, 2024
0caa4f9
Fix LongShort
lsk567 Nov 12, 2024
22d523e
Remove worker+1 in the EGS scheduler
lsk567 Nov 12, 2024
19410c7
Track instructions (transition guards) that contribute to hyperperiod…
lsk567 Nov 13, 2024
36e2fa1
@erlingrj finds a critical memory bug due to incorrect pointer type
lsk567 Nov 13, 2024
b9301df
Minor cleanup
lsk567 Nov 15, 2024
b4b0b8e
Remove some author tags for anonymity
lsk567 Nov 19, 2024
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Uclid5-based Verifier Tests
name: Uclid5-based Verifier Tests and Static Scheduler Tests

on:
# Trigger this workflow also on workflow_call events.
Expand Down Expand Up @@ -66,6 +66,11 @@ jobs:
echo "$pwd"
ls -la
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CVerifierTest.* core:integrationTestCodeCoverageReport
- name: Run static scheduler tests
run: |
echo "$pwd"
ls -la
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CStaticSchedulerTest.* core:integrationTestCodeCoverageReport
- name: Report to CodeCov
uses: ./.github/actions/report-code-coverage
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/only-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ jobs:
use-cpp: true
all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

# Run the Uclid-based LF Verifier benchmarks.
verifier:
uses: ./.github/workflows/c-verifier-tests.yml
# Run the Uclid-based LF Verifier tests.
verifier-and-static-scheduler:
uses: ./.github/workflows/c-verifier-and-static-scheduler-tests.yml
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spotless {
format 'linguaFranca', {
addStep(LfFormatStep.create())
target 'test/*/src/**/*.lf' // you have to set the target manually
targetExclude 'test/**/failing/**'
targetExclude 'test/**/failing/**', 'test/*/src/static/*.lf' // FIXME: Spotless does not know how to check static LF tests.
}
}

Expand Down
40 changes: 39 additions & 1 deletion cli/lfc/src/main/java/org/lflang/cli/Lfc.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
import org.lflang.generator.MainContext;
import org.lflang.target.property.BuildTypeProperty;
import org.lflang.target.property.CompilerProperty;
import org.lflang.target.property.DashProperty;
import org.lflang.target.property.LoggingProperty;
import org.lflang.target.property.NoCompileProperty;
import org.lflang.target.property.NoSourceMappingProperty;
import org.lflang.target.property.PrintStatisticsProperty;
import org.lflang.target.property.RuntimeVersionProperty;
import org.lflang.target.property.SchedulerProperty;
import org.lflang.target.property.SchedulerProperty.SchedulerOptions;
import org.lflang.target.property.SingleThreadedProperty;
import org.lflang.target.property.StaticSchedulerProperty;
import org.lflang.target.property.TracingProperty;
import org.lflang.target.property.TracingProperty.TracingOptions;
import org.lflang.target.property.VerifyProperty;
Expand All @@ -34,6 +37,8 @@
import org.lflang.target.property.type.LoggingType.LogLevel;
import org.lflang.target.property.type.SchedulerType;
import org.lflang.target.property.type.SchedulerType.Scheduler;
import org.lflang.target.property.type.StaticSchedulerType;
import org.lflang.target.property.type.StaticSchedulerType.StaticScheduler;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -141,6 +146,20 @@ public class Lfc extends CliBase {
description = "Specify the runtime scheduler (if supported).")
private String scheduler;

// FIXME: Add LfcCliTest for this.
@Option(
names = {"--mapper"},
description =
"Select a specific mapper (i.e., static scheduler) if scheduler is set to STATIC."
+ " Options: LB (default), EGS, MOCASIN")
private String staticScheduler;

// FIXME: Add LfcCliTest for this.
@Option(
names = {"--dash"},
description = "Execute non-real-time reactions fast whenever possible.")
private Boolean dashMode;

@Option(
names = {"--tracing"},
arity = "0",
Expand Down Expand Up @@ -309,14 +328,31 @@ private URI getRtiUri() {
}

/** Return a scheduler one has been specified via the CLI arguments, or {@code null} otherwise. */
private Scheduler getScheduler() {
private SchedulerOptions getScheduler() {
Scheduler resolved = null;
if (scheduler != null) {
// Validate scheduler.
resolved = new SchedulerType().forName(scheduler);
if (resolved == null) {
reporter.printFatalErrorAndExit(scheduler + ": Invalid scheduler.");
}
return new SchedulerOptions(resolved);
}
return null;
}

/**
* Return a static scheduler one has been specified via the CLI arguments, or {@code null}
* otherwise.
*/
private StaticScheduler getStaticScheduler() {
StaticScheduler resolved = null;
if (staticScheduler != null) {
// Validate scheduler.
resolved = new StaticSchedulerType().forName(staticScheduler);
if (resolved == null) {
reporter.printFatalErrorAndExit(staticScheduler + ": Invalid scheduler.");
}
}
return resolved;
}
Expand Down Expand Up @@ -379,13 +415,15 @@ public GeneratorArguments getArgs() {
List.of(
new Argument<>(BuildTypeProperty.INSTANCE, getBuildType()),
new Argument<>(CompilerProperty.INSTANCE, targetCompiler),
new Argument<>(DashProperty.INSTANCE, dashMode),
new Argument<>(LoggingProperty.INSTANCE, getLogging()),
new Argument<>(PrintStatisticsProperty.INSTANCE, printStatistics),
new Argument<>(NoCompileProperty.INSTANCE, noCompile),
new Argument<>(NoSourceMappingProperty.INSTANCE, noSourceMapping),
new Argument<>(VerifyProperty.INSTANCE, verify),
new Argument<>(RuntimeVersionProperty.INSTANCE, runtimeVersion),
new Argument<>(SchedulerProperty.INSTANCE, getScheduler()),
new Argument<>(StaticSchedulerProperty.INSTANCE, getStaticScheduler()),
new Argument<>(SingleThreadedProperty.INSTANCE, getSingleThreaded()),
new Argument<>(TracingProperty.INSTANCE, getTracingOptions()),
new Argument<>(WorkersProperty.INSTANCE, getWorkers())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Mock the CancelIndicator interface for testing.
*
* @author Erling Jellum
*
*/
public class MockCancelIndicator implements CancelIndicator {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.junit.jupiter.api.Test;
import org.lflang.target.Target;
import org.lflang.target.property.SchedulerProperty;
import org.lflang.target.property.SchedulerProperty.SchedulerOptions;
import org.lflang.target.property.type.SchedulerType.Scheduler;
import org.lflang.tests.TestBase;
import org.lflang.tests.TestRegistry.TestCategory;
Expand Down Expand Up @@ -56,7 +57,7 @@ private void runTest(Scheduler scheduler, EnumSet<TestCategory> categories) {
categories::contains,
Transformers::noChanges,
config -> {
SchedulerProperty.INSTANCE.override(config, scheduler);
SchedulerProperty.INSTANCE.override(config, new SchedulerOptions(scheduler));
return true;
},
TestLevel.EXECUTION,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.lflang.tests.runtime;

import java.util.List;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.lflang.target.Target;
import org.lflang.target.property.LoggingProperty;
import org.lflang.target.property.SchedulerProperty;
import org.lflang.target.property.SchedulerProperty.SchedulerOptions;
import org.lflang.target.property.type.LoggingType.LogLevel;
import org.lflang.target.property.type.SchedulerType.Scheduler;
import org.lflang.target.property.type.StaticSchedulerType;
import org.lflang.tests.TestBase;
import org.lflang.tests.TestRegistry;
import org.lflang.tests.Transformers;

public class CStaticSchedulerTest extends TestBase {
protected CStaticSchedulerTest() {
super(Target.C);
}

@Test
public void runStaticSchedulerTests() {
Assumptions.assumeTrue(
isLinux() || isMac(), "Static scheduler tests only run on Linux or macOS");

super.runTestsFor(
List.of(Target.C),
Message.DESC_STATIC_SCHEDULER,
TestRegistry.TestCategory.STATIC_SCHEDULER::equals,
Transformers::noChanges,
config -> {
// Execute all static tests using STATIC and LB.
// FIXME: How to respect the config specified in the LF code?
SchedulerProperty.INSTANCE.override(
config,
new SchedulerOptions(Scheduler.STATIC)
.update(StaticSchedulerType.StaticScheduler.LB));
// Keep the logging level at INFO because logs from the long
// running tests (e.g., RaceConditionCheck.lf) could overflow
// the buffer and stall the process.
LoggingProperty.INSTANCE.override(config, LogLevel.INFO);
return true;
},
TestLevel.EXECUTION,
false);
}
}
59 changes: 58 additions & 1 deletion core/src/main/java/org/lflang/AttributeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import static org.lflang.ast.ASTUtils.factory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -42,7 +43,7 @@
/**
* A helper class for processing attributes in the AST.
*
* @author Shaokai Lin
*
* @author Clément Fournier
* @author Alexander Schulz-Rosengarten
*/
Expand Down Expand Up @@ -142,6 +143,33 @@ public static String getAttributeValue(EObject node, String attrName) {
return value;
}

/**
* Return the first argument, which has the type Time, specified for the attribute.
*
* <p>This should be used if the attribute is expected to have a single argument whose type is
* Time. If there is no argument, null is returned.
*/
public static Time getFirstArgumentTime(Attribute attr) {
if (attr == null || attr.getAttrParms().isEmpty()) {
return null;
}
return attr.getAttrParms().get(0).getTime();
}

/**
* Search for an attribute with the given name on the given AST node and return its first argument
* as Time.
*
* <p>This should only be used on attributes that are expected to have a single argument with type
* Time.
*
* <p>Returns null if the attribute is not found or if it does not have any arguments.
*/
public static Time getAttributeTime(EObject node, String attrName) {
final var attr = findAttributeByName(node, attrName);
return getFirstArgumentTime(attr);
}

/**
* Search for an attribute with the given name on the given AST node and return its first argument
* as a String.
Expand Down Expand Up @@ -241,6 +269,35 @@ public static boolean hasCBody(Reaction reaction) {
return findAttributeByName(reaction, "_c_body") != null;
}

/** Return a time value that represents the WCET of a reaction. */
public static List<TimeValue> getWCETs(Reaction reaction) {
List<TimeValue> wcets = new ArrayList<>();
String wcetStr = getAttributeValue(reaction, "wcet");

if (wcetStr == null) {
wcets.add(TimeValue.MAX_VALUE);
return wcets;
}

// Split by comma.
String[] wcetArr = wcetStr.split(",");

// Trim white space.
for (int i = 0; i < wcetArr.length; i++) {
wcetArr[i] = wcetArr[i].trim();

// Split by inner space.
String[] valueAndUnit = wcetArr[i].split(" ");

long value = Long.parseLong(valueAndUnit[0]);
TimeUnit unit = TimeUnit.fromName(valueAndUnit[1]);
TimeValue wcet = new TimeValue(value, unit);
wcets.add(wcet);
}

return wcets;
}

/** Return the declared label of the node, as given by the @label annotation. */
public static String getLabel(EObject node) {
return getAttributeValue(node, "label");
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/lflang/LinguaFranca.xtext
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Attribute:
;

AttrParm:
(name=ID '=')? value=Literal;
(name=ID '=')? (value=Literal | time=Time);

/////////// For target parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import java.util.List;

/** Modeled after {@link AbstractParseTreeVisitor}. */
/**
* Modeled after {@link AbstractParseTreeVisitor}.
*
*
*/
public abstract class AbstractAstVisitor<T> implements AstVisitor<T> {

@Override
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/lflang/analyses/c/AstUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.misc.Interval;

/**
* A utility class for C ASTs
*
*
*/
public class AstUtils {

public static CAst.AstNode takeConjunction(List<CAst.AstNode> conditions) {
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/java/org/lflang/analyses/c/AstVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import java.util.List;

/** Modeled after ParseTreeVisitor.class */
/**
* Modeled after ParseTreeVisitor.class
*
*
*/
public interface AstVisitor<T> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
import org.lflang.dsl.CBaseVisitor;
import org.lflang.dsl.CParser.*;

/** This visitor class builds an AST from the parse tree of a C program */
/**
* This visitor class builds an AST from the parse tree of a C program
*
*
*/
public class BuildAstParseTreeVisitor extends CBaseVisitor<CAst.AstNode> {

/** Message reporter for reporting warnings and errors */
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/lflang/analyses/c/CAst.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import java.util.ArrayList;
import java.util.List;

/**
* C AST class that contains definitions for AST nodes
*
*
*/
public class CAst {

public static class AstNode implements Visitable {
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/java/org/lflang/analyses/c/CAstVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import java.util.List;

/** Modeled after CVisitor.java */
/**
* Modeled after CVisitor.java
*
*
*/
public interface CAstVisitor<T> extends AstVisitor<T> {

T visitAstNode(CAst.AstNode node);
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/lflang/analyses/c/CBaseAstVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/**
* A base class that provides default implementations of the visit functions. Other C AST visitors
* extend this class.
*
*
*/
public class CBaseAstVisitor<T> extends AbstractAstVisitor<T> implements CAstVisitor<T> {

Expand Down
Loading
Loading