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

Impove tasklet composition extensibility #397

Merged
merged 1 commit into from
Apr 21, 2023
Merged

Impove tasklet composition extensibility #397

merged 1 commit into from
Apr 21, 2023

Conversation

lkurija1
Copy link
Contributor

Description

This PR improves the extensibility of tasklet composition by allowing the developer to extend the tasklet set on the original Composer by declaring new tasklets under CloneComposer context and then use the composer to get originally implmented tasklets by alias and perform composition on them. Implemented tasklet/composer operations:

  • insert_before which inserts a tasklet before the target tasklet
  • insert_after which inserts a tasklet after the target tasklet
  • replace_with which replaces the target tasklet with the new tasklet
  • remove which removes the target tasklet

The implemented operations work with loop edges, except for remove which will raise NotImplementedError if the target tasklet has loop edges.

This PR demonstrates the extensibility of tasklet composition by refactoring the existing coord syncfl mode to use the new extensibility (demonstrating the reduction in LOC needed to achieve same results).

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@codecov-commenter
Copy link

codecov-commenter commented Apr 14, 2023

Codecov Report

Merging #397 (f291383) into main (5bd145f) will not change coverage.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main     #397   +/-   ##
=======================================
  Coverage   15.15%   15.15%           
=======================================
  Files          48       48           
  Lines        2778     2778           
=======================================
  Hits          421      421           
  Misses       2328     2328           
  Partials       29       29           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@lkurija1 lkurija1 requested a review from myungjin April 14, 2023 00:24
Copy link
Contributor

@myungjin myungjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left two comments. otherwise, it looks good to me.

lib/python/flame/mode/composer.py Outdated Show resolved Hide resolved
for child in self.chain[parent_t]:
q.put(child)

def insert_after(self, alias, new_tasklet):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use insert_before to implement insert_after?

you basically need to get the child of the tasklet that you want to do "insert_after" and call "insert_before" with the child's tasklet. I am not certain if this way has some ramification though.

This way, you can probably make the implementation more concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will still be the case when inserting after the last tasklet. I created a facade of insert, which calls before/after based on the after flag, to make further changes backwards compatible. And I'm working on a broader approach to the problem.

@myungjin
Copy link
Contributor

@elqurio Regarding the commit log, please use a short title (topic) and add two new lines before detailed description is added. This way, when git log --oneline is executed, we won't see a bloated message in a single line.

@lkurija1
Copy link
Contributor Author

lkurija1 commented Apr 18, 2023

@elqurio Regarding the commit log, please use a short title (topic) and add two new lines before detailed description is added. This way, when git log --oneline is executed, we won't see a bloated message in a single line.

Addressed this one

myungjin
myungjin previously approved these changes Apr 18, 2023
Copy link
Contributor

@myungjin myungjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

This PR improves the extensibility of tasklet composition by allowing the developer to extend the tasklet set on the original `Composer` by declaring new tasklets under `CloneComposer` context and then use the composer to get originally implmented tasklets by alias and perform composition on them.
Implemented tasklet/composer operations:
- `insert_before` which inserts a tasklet before the target tasklet
- `insert_after` which inserts a tasklet after the target tasklet
- `replace_with` which replaces the target tasklet with the new tasklet
- `remove` which removes the target tasklet

The implemented operations work with loop edges, except for `remove` which will raise NotImplementedError if the target tasklet has loop edges.

This PR demonstrates the extensibility of tasklet composition by refactoring the existing coord_syncfl mode to use the new extensibility (demonstrating the reduction in LOC needed to achieve same results).
Copy link
Contributor

@myungjin myungjin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lkurija1 lkurija1 merged commit f8f1da9 into cisco-open:main Apr 21, 2023
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.

3 participants