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 sedwards-lab/ssm library directly #46

Merged
merged 198 commits into from
Aug 5, 2021
Merged

Use sedwards-lab/ssm library directly #46

merged 198 commits into from
Aug 5, 2021

Conversation

j-hui
Copy link
Collaborator

@j-hui j-hui commented Jul 14, 2021

@sedwards-lab very recently refactored the upstream runtime library at https://github.com/sedwards-lab/ssm . It simplifies my own refactor (on that repo's sched branch), which I had ported over earlier (in #30). The library is integrated into this repo as a git subtree (rather than the more common git submodule approach). This technique directly splices sedwards-lab/ssm's git history into this repo's history, so there isn't any need to do git submodule init or anything of the sort. This should discourage invasive changes to the runtime library from here, but should the need to make changes arise, it's also possible to push only the commits from the runtime subdirectory back upstream.

There's still a load of work to be done here, but I'm opening this PR now as a draft to document planned changes to existing components of this project. In particular:

  • All SSM library-relevant symbols are now updated to have ssm_ as a prefix. A lot of other symbols are renamed too, following Stephen's changes.
  • The edsl compiler is no longer responsible for synthesizing the main function (fixing Entry point and C main function #33); instead, the main function is defined by the platform, which invokes whatever is pointed to by ssm_entry_point to kick off the SSM execution.
  • The semantics and structure of the event trace is redesigned and simplified (addressing Design Debug interface #24 and making progress on Improve Trace #17 ), so as to be less invasive with respect to the runtime library (which should be tested separately anyway). That is, the event logging is lifted out of the runtime library and the type implementation (the update function). Instead, that logging is delegated to the platform main loop driver and the generated code.

At this time of writing, I'm still working on the event trace semantics, but I'm planning on logging the following events:

  • The names of and arguments to all procedures upon forking
  • The length of the event queue between ticks
  • The time of the next event prior to calling tick (i.e., what the next now will be)
  • The value of all local variables upon entering and leaving the step function (how I'll handle uninitialized variables is not yet clear) Removing this for now because this saves me a little time fussing with uninitialized values and string formatting in C. That being said, we can easily distinguish by initialized vs uninitialized values by looking at the last_updated timestamp. So it shouldn't be too hard, just more code.

The former shall be logged in the generated code, while the latter two will be logged by the main loop driver of the trace platform.

At each step, the generated will increment a microtick that will be used bound non-terminating generated code.

Each event trace will also terminate with one of the following conditions (EDIT: see ssm/SSM/Interpret/Trace.hs for details):

  • terminated gracefully
  • microtick exhausted (did not terminate)
  • act queue full
  • event queue full
  • depth exhausted
  • invalid after (e.g., earlier than now)

There may be a need for more event traces or terminal conditions, which I will discover as I proceed.

sedwards-lab and others added 30 commits May 30, 2020 20:35
…At this commit, runtime/include and runtime/src were soft-linked to their corresponding directories in sedwards-lab/ssm
-       Use camel case for Haskell variables, e.g., global_references
-       Use snake case for C symbols
-       Deprecate `struct ssm_act *ssm_entry_point(..)` in favor of more
        opaque `void ssm_initialize_program(..)`, which schedules the
        entry point internally. This allows more flexibility in the
        future for adjusting priorities for stuff like output handler
        processes without having to coordinate with the tick driver.
@j-hui
Copy link
Collaborator Author

j-hui commented Aug 5, 2021

Merging this into master now because this PR is becoming a behemoth. Thanks for all the great work everyone!

@j-hui j-hui merged commit a8bf9de into master Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants