-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add Parallel task support. #28
Merged
Merged
Conversation
This file contains 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
Parallel tasks are the complement of Method tasks. While a method returns a list of instructions to be executed in sequence, a parallel task returns a list of instructions to be executed in parallel. When a parallel task is found, the planner will create a 'fork' in the plan, where sub-plans are executed in concurrent executions. While actions may now be executed in parallel, the state object is still shared, so this PR also provides utilities for conflict detection during testing. Change-type: minor
This breaks up index into multiple files to simplify the move to a DAG representation of a plan. Change-type: minor
Plan nodes can now be of three types, a regular action node (same as before), a fork node, creating branching on the plan, and an empty node, to indicate joining of previously created branches. This commit also updates all existing functions to deal with this new plan format, even though the planner still cannot generate these types of plans Change-type: minor
pipex
force-pushed
the
parallel-tasks
branch
5 times, most recently
from
August 19, 2023 01:55
4acfeef
to
ef08093
Compare
WIP Change-type: minor
This adds a new state to the trace diagram (`found`). The state is on the last level search when no more operations are pending. This allows the digramming tool to draw joining paths by using the metadata in the trace. Change-type: minor
Diagram would break in the case of parallel tasks with conflicts, this is because an action may be chosen again after a previous compound task was chosen, which means an action in the decision tree may have multiple parents. We were assuming that an action could only have a single parent which would mess up the diagram Change-type: patch
This improves the API of the plan builder to be simpler and less confusing. The `end` method of the builder now returns a string. The `simplified` method has been renamed to `stringify` and now returns a string instead of an array. This should make it easier to visually inspect differences betwen the expected and the generated plan Change-type: minor
pipex
force-pushed
the
parallel-tasks
branch
from
September 2, 2023 00:07
62bac39
to
6fff8a1
Compare
With this change, all methods are assumed to be parallel by default unless conflicts are detected on the parallel branches, in which case the planner will switch to sequential operation. Change-type: minor
I self-certify! |
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.
This PR adds support for parallelism in method tasks on Mahler.
While expanding a method during plan search, the planner will default to expanding methods in parallel branches. Before adding the result of the method back to the plan, the evaluation will check for conflicts on parallel branches. This is done by inspecting the list of changes, calculated as a
JSON patch, and looking for intersecting changes between any branches. If a conflict is found, then the planner will re-do the expansion of the method in sequence.
For example, given the following code
Calling
byTwo
in parallel results in a conflict, as we are modifying the same part of the state. Thus the planner treats the method as a sequential operation, resulting in the following planNow let's take the following definition.
Counters
a
andb
can be safely increased in parallel, which results in the following expansionThis PR also updates utilities for testing that plans correspond to an expected outcome. For instance, for the latter example above, we may want to test that the resulting plan corresponds with our expectations. On testing, we could do the following
Where
Creates a string representation of a plan with two forks, each fork with two branches updating values
a
andb
respectivelyThe string representation will return a string like the following, that should make it easier to compare the plans visually
Where
-
indicates an action,+
indicates a fork and~
indicates a branch of the forkNote that despite the amount of changes, this is an initial PR to enable parallelism. Conflict detection and backtracking when parallelism fails is still rudimentary, and this is still heavily lacking documentation
Change-type: minor