Skip to content
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

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

dolio
Copy link
Contributor

@dolio dolio commented Dec 13, 2024

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 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.

@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 in run.compiled because some of the recursive dependencies have been pruned away). Let me know if it solves the cloud issues.

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.
Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

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

Awesome! cc @ChrisPenner

Copy link
Contributor

@ChrisPenner ChrisPenner left a 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!

@aryairani
Copy link
Contributor

Should I go ahead and merge this, or are we waiting for a test?

@ceedubs
Copy link
Contributor

ceedubs commented Dec 16, 2024

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.

@aryairani
Copy link
Contributor

@ceedubs Probably yes, can we sync up tomorrow or so to figure out a good way to do this

Copy link
Contributor

@ceedubs ceedubs left a 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!

@aryairani aryairani merged commit 28973da into trunk Dec 16, 2024
46 checks passed
@aryairani aryairani deleted the fix/interp-inlining branch December 16, 2024 17:12
aryairani pushed a commit that referenced this pull request Dec 18, 2024
this specific test may become ineffective if the code serialization algorithm someday includes termlinks as dependencies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants