Repository navigation
Fix common-subexpression elimination across domains - #362
Merged
take-cheeze merged 1 commit intoNov 4, 2026
Merged
Conversation
Signed-off-by: sean0407 <sean0407@gmail.com>
sean0407
force-pushed
the
codex/onnx-optimizer-343-cse-domain
branch
from
October 21, 2026 11:26
f501341 to
905c262
Compare
take-cheeze
approved these changes
Nov 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.
Summary
Fixes #343 by including each node's ONNX domain in both the common-subexpression hash and equality comparison. This prevents a standard-domain operator from being merged with a local function that has the same
op_type, inputs, and attributes but different semantics.Reproduction
The regression test builds a valid model containing standard-domain
Add(X, X)and a locallocal::Add(X, X)function whose body multiplies its inputs. Before this change,eliminate_common_subexpressionmerged the nodes and the optimized model produced a different output from the original.Changed files
onnxoptimizer/passes/cse_util.honnxoptimizer/test/optimizer_test.pyChecks run
pytest -n 1 onnxoptimizer/test/optimizer_test.py -k "eliminate_common_subexression or respects_domain"— 4 passed in an isolated container.git diff --check— passed.