-
Notifications
You must be signed in to change notification settings - Fork 272
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
Do reference-based pruning for ucm compile, turn back on inlining #5507
Conversation
The pruning was causing problems with compiled programs when inlining was on, because it would prune based on the inlined code. The inlined code may have certain intermediate combinators omitted, but those are still necessary to have a full picture of the source code. Since `compile` was using the MCode numbering and backing out which References are necessary from that, it would throw away the source code for these intermediate definitions. This then caused problems when e.g. cloud (running from a compiled build) would try to send code to other environments. It wouldn't have the intermediate terms necessary for the remote environment to do its own intermediate->interpreter step. This new approach does all the 'necessary terms' tracing at the intermediate level, and then instead determines which MCode level defintions are necessary from that. This means that the pruning is no longer sensitive to the inlining. So, it should be safe to turn inlining back on.
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.
Awesome! cc @ChrisPenner
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.
Great!! Glad you were able to track it down!
Should I go ahead and merge this, or are we waiting for a test? |
Thanks! I just kicked off a pre-release and will test this today. But is it possible to add a regression test? Can it somehow be incorporated into the current "golden file" tests or something? Running the klogs demo and seeing if it hangs is a time-consuming way to try to catch this and isn't currently happening in CI. |
@ceedubs Probably yes, can we sync up tomorrow or so to figure out a good way to do this |
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.
Looks like it fixes the hang in the klogs demo!
this specific test may become ineffective if the code serialization algorithm someday includes termlinks as dependencies.
The interpreter state pruning was causing problems with compiled programs when inlining was on, because it would prune based on the inlined code. The inlined code may have certain intermediate combinators omitted, but those are still necessary to have a full picture of the source code. Since
compile
was using theMCode
numbering and backing out whichReferences
are necessary from that, it would throw away the source code for these intermediate definitions. This then caused problems when e.g. cloud (running from a compiled build) would try to send code to other environments. It wouldn't have the intermediate terms necessary for the remote environment to do its ownintermediate->interpreter step.
This new approach does all the 'necessary terms' tracing at the intermediate level, and then instead determines which
MCode
level defintions are necessary from that. This means that the pruning is no longer sensitive to the inlining. So, it should be safe to turn inlining back on.@ceedubs This fixes my local test, which is just looking up recursive dependencies of something in base in a compiled program (i.e. it works fine doing
run
in ucm, because everything is loaded, but not inrun.compiled
because some of the recursive dependencies have been pruned away). Let me know if it solves the cloud issues.