Skip to content

[Pass] Fix bugs in LiftConstantsToInitializersPass #2189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

titaiwangms
Copy link
Contributor

@titaiwangms titaiwangms commented Apr 11, 2025

Fix #2184

(1) Fix the corner case when the constant is the graph output, we don't lift it.
(2) Add an option to the pass controlling lifting all constants to initializers, or only "value". (following ort pass: https://github.com/microsoft/onnxruntime/blob/d7c688e15c1dc40f57140bff08c78e01a88b19fc/onnxruntime/python/tools/transformers/onnx_model.py#L525). Default to False, where we only lift "value".

Copy link

codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 95.74468% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.26%. Comparing base (6bdfcfd) to head (9dcdda7).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nxscript/ir/passes/common/constant_manipulation.py 92.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2189      +/-   ##
==========================================
+ Coverage   74.22%   74.26%   +0.03%     
==========================================
  Files         224      224              
  Lines       29381    29402      +21     
  Branches     3415     3418       +3     
==========================================
+ Hits        21808    21834      +26     
+ Misses       6418     6416       -2     
+ Partials     1155     1152       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@justinchuby justinchuby left a comment

Choose a reason for hiding this comment

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

Thank you!

@titaiwangms titaiwangms enabled auto-merge (squash) April 11, 2025 21:18
@titaiwangms titaiwangms merged commit 4633a3a into microsoft:main Apr 11, 2025
25 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Optimizer fails on multi-out control flows
2 participants