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

Fuse mat mul with activation following it #566

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

boris-drazic
Copy link
Contributor

Problem description

torch.ops.aten.mm.default and torch.ops.aten.bmm.default are lowered to ttnn.mm, which has option to execute an activation function together with the multiplication. The three supported functions are torch.nn.functional.relu, torch.nn.functional.gelu, and torch.nn.functional.silu. Executing activation together with multiplication is faster, so mat mul and activation function should be fused.

What's changed

MMFusionPass added to perform the fusion of mat mul and activation function that follows it.
Added tests/optimization/test_mm_fusion.py to test fusion.

@ayerofieiev-tt
Copy link
Member

Please run pre-commit install in the repo root.

Copy link
Member

@ayerofieiev-tt ayerofieiev-tt left a comment

Choose a reason for hiding this comment

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

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