ssm-lang / Scoria

This is an embedding of the Sparse Synchronous Model, in Haskell!
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Use sedwards-lab/ssm library directly #46

Closed j-hui closed 2 years ago

j-hui commented 2 years ago

@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:

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

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):

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

j-hui commented 2 years ago

Currently, this branch is generating compiling code when the entry point takes no arguments. I still need to adjust the compilation interface to check for and enforce this, and modify the test suite to wrap all generated functions with a parameter-less main functin. In doing so, I'll also clean out some test cases which don't actually document what they're testing, addressing #41 .

j-hui commented 2 years ago

@Rewbert not yet ready for merging, but maybe good to start reviewing now. I've highlighted some important changes with comments.

stack test isn't quite working yet, and most of the regression tests are broken. This is because we now have a new requirement that the entry point of compiled programs abide by a particular type signature which almost none of the regression tests abide by. I will fix these soon.

We've already discussed offline (i.e., Slack), but this PR in its current state drastically weakens the expressiveness of the event trace. This shouldn't be too hard to add back in, but it'll be a little fussy. @sedwards-lab and I discussed useful things to add to the event trace and concluded that while more fine-grained event logging may help us find other bugs, the compiler is in a more stable point that this is not a priority, compared to getting the full build pipeline (e.g., getting I/O working) working.

j-hui commented 2 years ago

@Rewbert all tests are passing again, this is ready for full review

Rewbert commented 2 years ago

I'll take a closer look at this pull request next week, when I am back in civilization :)

j-hui commented 2 years ago

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