Skip to content

[Pass] Support lift constants to initializers pass #2160

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

Merged

Conversation

titaiwangms
Copy link
Contributor

@titaiwangms titaiwangms commented Apr 2, 2025

Fix #2156

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 91.37931% with 10 lines in your changes missing coverage. Please review.

Project coverage is 74.13%. Comparing base (3a6e4cc) to head (e648167).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...nxscript/ir/passes/common/constant_manipulation.py 84.00% 5 Missing and 3 partials ⚠️
...ipt/ir/passes/common/constant_manipulation_test.py 96.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2160      +/-   ##
==========================================
+ Coverage   74.03%   74.13%   +0.09%     
==========================================
  Files         222      224       +2     
  Lines       29239    29355     +116     
  Branches     3399     3414      +15     
==========================================
+ Hits        21647    21762     +115     
- Misses       6439     6440       +1     
  Partials     1153     1153              

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

@titaiwangms titaiwangms marked this pull request as ready for review April 4, 2025 23:32
@titaiwangms titaiwangms marked this pull request as draft April 5, 2025 00:05
@titaiwangms titaiwangms marked this pull request as ready for review April 9, 2025 00:24
@justinchuby justinchuby added module: IR Intermediate representation topic: passes labels Apr 10, 2025
const_value=tensor,
)
assert node.graph is not None
assert isinstance(node.graph, ir.Graph)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinchuby does this make sense? I think there should not be any ir.Function node coming out from recursive iterator?

Copy link
Collaborator

@justinchuby justinchuby Apr 10, 2025

Choose a reason for hiding this comment

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

Does make sense. Thanks! The reason why it was annotated with graph | function is that the “owning graph” can be a function when the node is part of a function. Maybe there are better ways to do it 🤔

Copy link
Collaborator

@gramalingam gramalingam Apr 10, 2025

Choose a reason for hiding this comment

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

(Unrelated to this PR): Isn't a Function object a wrapper around a Graph object? Does node.graph not return that graph object even in the case of function nodes?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Technically the graph in a function is private and not used directly. It is currently an implementation detail

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry I was wrong. It is pointed to a graph when we call function.append, but it is not when we call ir.Node(graph=function). I need to figure out how to reconcile this. Suggestions appreciated. #2181

Copy link
Collaborator

Choose a reason for hiding this comment

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

@titaiwangms titaiwangms force-pushed the titaiwang/add_constant_to_initilizer_pass branch from c3cec70 to a2e9d2a Compare April 10, 2025 17:16
@justinchuby justinchuby enabled auto-merge (squash) April 10, 2025 17:47
@justinchuby justinchuby merged commit e659cb4 into microsoft:main Apr 10, 2025
23 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: IR Intermediate representation topic: passes
Projects
Development

Successfully merging this pull request may close these issues.

Create a constant to initializer pass
3 participants