Skip to content

Skip overridable initializer fusion - #32143

Merged
Akshay Sonawane (apsonawane) merged 2 commits into
mainfrom
fix/fuse-initializers-overridable-input
Aug 20, 2026
Merged

Akshay Sonawane (apsonawane) merged 2 commits into
mainfrom
fix/fuse-initializers-overridable-input

Conversation

@apsonawane

Copy link
Copy Markdown
Contributor

This pull request updates the logic for determining whether a node's input is a valid initializer for fusion and adds a new unit test to ensure that initializers which can be overridden (i.e., initializers that are also graph inputs) are properly skipped during fusion. The main changes are:

Logic Update

  • In IsNodeValidForFusion, the check for a valid initializer now uses graph_utils::GetConstantInitializer, ensuring that only constant initializers (not those that can be overridden by graph inputs) are considered valid for fusion.

Testing Improvements

  • Added a new test, FuseInitializersSkipsOverridableInitializer, to verify that the transformer skips fusion for initializers that are also graph inputs and can be overridden. This test ensures the fusion transformation does not incorrectly modify such initializers.
  • Included the graph_transform_test_builder.h header to support the new test.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Prevents fusion of overridable initializers, preserving runtime input semantics.

Changes:

  • Uses constant-initializer detection before fusion.
  • Adds regression coverage for initializer-backed graph inputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
onnxruntime/core/optimizer/fuse_initializers_transformer.cc Restricts fusion to constant initializers.
onnxruntime/test/optimizer/fuse_initializers_transformer_test.cc Tests that overridable initializers remain unfused.

πŸ’‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@apsonawane
Akshay Sonawane (apsonawane) merged commit 8805b39 into main Aug 20, 2026
92 of 93 checks passed
@apsonawane
Akshay Sonawane (apsonawane) deleted the fix/fuse-initializers-overridable-input branch August 20, 2026 17:53
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.

3 participants