Fix DivMulFusion producer edge rewiring - #32430
Open
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
Open
Fix DivMulFusion producer edge rewiring#32430Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
Sylvester Kaczmarek (sylvesterkaczmarek) wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Sylvester Kaczmarek (sylvesterkaczmarek)
September 3, 2026 19:46
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix correctly preserves graph connectivity and includes adequate regression coverage.
Pull request overview
Fixes DivMulFusion graph rewiring so node-produced replacement inputs retain their producer edges.
Changes:
- Adds the producer-to-fused-
Divedge during rewiring. - Adds regression coverage validating edge preservation and graph resolution.
File summaries
| File | Description |
|---|---|
onnxruntime/core/optimizer/div_mul_fusion.cc |
Preserves producer edges during fusion. |
onnxruntime/test/optimizer/div_mul_fusion_test.cc |
Tests node-produced replacement inputs. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Xavier Dupré (xadupre)
approved these changes
Sep 4, 2026
Xavier Dupré (xadupre)
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #32413, #32414 and #32416.
DivMulFusionrewrites1 / x1 * x2tox2 / x1by replacing input 0 of theDivwith the otherMulinput.ReplaceNodeInput()only changes the NodeArg and intentionally does not create a graph edge.When
x2is produced by another node, its producer edge still targets theMul.FinalizeNodeFusion()then removes that edge with theMul, leaving the newDivconsuming a value without a producer edge. A later producer-elimination rule can remove the producer and leave an invalid graph.This change adds the producer edge from the replacement input to the fused
Divwhenever the replacement input is node-produced. Graph inputs and initializers retain the existing behaviour.Tests
Adds a regression graph with a node-produced Mul input and verifies the fused Div retains the producer connection and the graph resolves successfully.