Merged
Conversation
ekiwi
reviewed
Apr 28, 2025
ekiwi
reviewed
Apr 29, 2025
b763a8e to
f2f671e
Compare
Contributor
|
Scheduler logic looks good, great work!! Just left a few comments re: style & discussed on Slack how we clean up |
ngernest
approved these changes
May 20, 2025
Co-authored-by: Ernest Ng <eyn5@cornell.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thread Scheduling Implementation
Thread Management:
We create a
Threadstruct to encapsulate transaction state, symbol table, and execution position. We maintain collections of active, next, and inactive threads in theSchedulerstruct, which also holds theEvaluatorthat, in turn, contains the underlying sim. We then implement context switching between threads.Execution Control:
When a fork is reached: A new thread is created from the next available transaction as tracked by the
Scheduler. The forking thread continues execution, and the new thread is added to the next execution batch with its next statement to evaluate being the beginning of its transaction (i.e.tr.body). If there are no more available transactions, fork() essentially does nothing.When a step is reached: The thread's execution is paused, the thread is moved to the next execution batch, and Control returns to the scheduler
For other statements, normal execution simply continues or if the next statement in the transaction is
None, the thread is moved to theinactive_threadsvector.Scheduling Logic:
Other changes.:
diagnostic.rshas a minor change to handle assignment error emissions--just a simple assertion that if the received expressions are from different files, clearly something has gone wrong since an assignment statement cannot span two different files. I created a helper inparser.rsto reduce duplicate parsing code throughout testing modules in the codebase. The*.snapfiles are just testing files that can be ignored.Testing: Tests are now in the Scheduler for Adder and Multiplier. The simple_if and simple_while tests are ignored for now (still working on building them). the tests in the interpreter are now ignored because they will not work; all tests must now go through the scheduler, and these should be moved to being single-threaded scheduler tests (in a later PR).