Allow compiler cache to partially load modules#414
Merged
braxtonmckee merged 3 commits intodevfrom Feb 15, 2023
Merged
Conversation
1618ac7 to
640eac5
Compare
640eac5 to
9b27dc7
Compare
Current implementation of the interface, used via _loadFromCompilerCache, runs loadForSymbol for a given link name and then returns two dicts representing everything the cache touched during this load process. Maintaining this interface makes the partial-load refactor difficult, and muddies the converter layers/cache relationship. Here we alter the API so that we can ask the cache for a TypedCallTarget, and add modules, and that's it. This means getting rid of _loadFromCompilerCache, and associated registers for tracking what's being converted. Also means passing the cache down to the native_ast_to_llvm layer.
03a3809 to
b8f7628
Compare
Previously we would always attempt to link and validate all global variables when loading a module from the cache. This caused linking errors, or validation errors, or deserialization errors, and meant we needed the mark_invalid mechanism for handling modules with outdated global variables. Here we add double-serialised global variables, and only deserialize,link&validate the subset required for the function required (and its dependencies). This requires the cache to store a function and global_var dependency graph. Also add utility methods for GlobalVariableDefinition.
a3d7d76 to
641fa93
Compare
Pickle supports a protocol where __reduce__returns a string giving the global name. Implementing this behaviour lets us serialize numpy ufuncs. Also adjust installInflightFunctions to handle new load behaviour, fix an instability caused by not leaving LoadedModule objects in memory, and adjust alternative test.
641fa93 to
b58b173
Compare
6 tasks
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This change removes the notion of invalid and valid modules, by only deserialising, linking, and validating the global variables necessary for the function currently being loaded. Also fixes #417, which the serialisation of the globals exposed.
Approach
How Has This Been Tested?
One new test in compiler_cache_test and alterations to two others.
Types of changes
Checklist: