Skip to content

Conversation

@qti-yuduo
Copy link
Contributor

Motivation

ClipQuantFusion in clip_quantizelinear.cc calls graph_utils::RemoveNode() without first checking graph_utils::CanRemoveNode(). When a Clip node has min/max inputs from DequantizeLinear nodes (instead of initializers), it has multiple input edges. RemoveNode() throws exception:

 [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Exception during initialization: graph_utils.cc:650 bool onnxruntime::graph_utils::RemoveNode(onnxruntime::Graph&, onnxruntime::Node&) Should be unreachable if CanRemoveNodeAndMergeEdges is in sync with the logic here.

Fix:

Added CanRemoveNode() check to ClipQuantFusion::SatisfyCondition() to skip nodes that cannot be safely removed.

Test:

Added ClipQuantFusion_MultipleInputEdges test that creates a Clip node with min from a DQ node (2 input edges) and verifies the optimizer doesn't crash.

@qti-yuduo qti-yuduo changed the title [QNN EP] Fix ClipQuantFusion crash when Clip has multiple input edges Fix ClipQuantFusion crash when Clip has multiple input edges Jan 7, 2026
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.

1 participant