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

Ports the graph tracing to torch.fx #28

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

Ports the graph tracing to torch.fx #28

wants to merge 2 commits into from

Conversation

Jegp
Copy link
Collaborator

@Jegp Jegp commented Dec 9, 2024

This PR ports the graph tracing to torch.fx instead of using the homebrewed graph tracer.

TBC...

Copy link

@chanokin chanokin left a comment

Choose a reason for hiding this comment

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

this is great work, almost ready!

appear with the qualified name ``foo.bar.baz`` here.
"""
# Tests that the module is in the list of custom leaves
if self.custom_leaf_modules and isinstance(m, self.custom_leaf_modules):

Choose a reason for hiding this comment

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

Do we need to check for torch.nn.Sequential here?

nodes = {}
edges = []
ignored_nodes = set()
skipped_nodes = set()

Choose a reason for hiding this comment

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

Does skipped_nodes means nodes we still need to process?

continue
elif node.op == "output":
nodes[str(node.name)] = nir.Output(np.array([1]))
elif node.op == "call_function":

Choose a reason for hiding this comment

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

Should we add a check for other non-allowed functions (multiplies or divisions) and add an exception?

assert len(_filter_edges(graph, nir.Affine, nir.Output)) == 1


def test_trace_addition():

Choose a reason for hiding this comment

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

how about substraction? does that work?

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.

2 participants