Skip to content

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