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

Add resolve condition pass #1645

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Add resolve condition pass #1645

wants to merge 5 commits into from

Conversation

luigifusco
Copy link
Contributor

This pass takes a Python condition as a string (e.g. "flag == True"), parses it and, assuming it always holds throughout the SDFG, it deletes all unsatisfiable branches.

This is a first step towards implementing "specialized SDFGs". While playing with some code-replication inducing transformations I noticed that the graph quickly became too big to work with. This pass can help users generate different specialized SDFGs and work on those. As an example, if flag is an input boolean that is never written two, two SDFGs, one with flag set to true and the other with flag set to false can be created and worked on indipendently.

Creating as draft since multiple design decisions are still unclear to me

import ast


def eliminate_branch(sdfg: sd.SDFG, initial_edge: sd.graph.Edge):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like yes, it should become a reusable, documented utility function :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed! This one is a good candidate for "building block" used by multiple transformations

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