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

PR for MoveLinearPastEltwiseMul transformation #1275

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

shashwat1198
Copy link
Contributor

PR Description:

This PR introduces a new transformation, MoveLinearPastEltwiseMul, which optimises the computation graph by moving linear multiplication operations past elementwise multiplication operations when possible.

  • Pattern before transformation:
    [(x × A) × (y × B)]

  • Pattern after transformation:
    [(x × y) × (A × B)]

Where (x) and (y) are dynamic inputs, and (A) and (B) are constant tensors.

Key Changes:

  • The transformation identifies mul operations that can be merged and moves linear mul nodes past elementwise mul nodes in the graph.
  • The transformation checks for mul operations with shared initializers and merges them, removing redundant nodes.
  • The model is updated with new initializers after the transformation to ensure correctness.
  • A post-transformation pass is performed to infer shapes for any updated nodes in the graph.

@shashwat1198 shashwat1198 changed the base branch from main to dev February 10, 2025 14:35
Signed-off-by: shashwat1198 <[email protected]>
@fpjentzsch
Copy link
Collaborator

We already have this in FINN+ as the "MoveConstMulPastJoinMul" transformation.

Christoph (@iksnagreb) added it as part of the StreamlinePlus PR (eki-project#39), which doesn't yet have an equivalent in this repository I believe.

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