-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
serialize bits values and QuoteNodes in IR encoding #45173
Conversation
This seems to be a bit crashy? I can reproduce it sometimes but not always. E.g.
or
|
545fae3
to
6cb8873
Compare
Ok, what happened was this: if a value is not in a method roots list, but is later needed by codegen, codegen will add it to the roots list, but de-duplicating values only by address instead of using This PR now fully fixes that situation. Codegen doesn't need integer indices for the values it roots; it just needs them rooted somewhere. So I added a global IdDict of values that might be needed by generated code, so they are de-duplicated by Some possible future improvements to constant handling:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm
6cb8873
to
f0e8473
Compare
ad9a578
to
7bcdcd0
Compare
7bcdcd0
to
30c9882
Compare
30c9882
to
1026b61
Compare
- serialize bits values and QuoteNodes in IR encoding Using this instead of the `roots` array avoids scaling problems in functions with many constants. - move roots created by codegen to a single global table, allowing reuse of egal values and keeping method roots lists shorter
1026b61
to
b91aeb3
Compare
Is there any chance that this gets backported to 1.8.x given that it also fixes some bugs we observed in Symbolics.jl/RuntimeGeneratedFunctions or is this considered a latency improvement only and thus waits until 1.9? |
I think this can be backported. |
- serialize bits values and QuoteNodes in IR encoding Using this instead of the `roots` array avoids scaling problems in functions with many constants. - move roots created by codegen to a single global table, allowing reuse of egal values and keeping method roots lists shorter (cherry picked from commit 425f6ff)
Using this instead of the
roots
array avoids scaling problems in functions with many constants. This might also be better for precompiling. Grows the system image by 1.6%, but is probably worth it. Copying small bits values in code just seems like the right thing.