Repository navigation
Key the compiled models by the load options and honor RECOMPILE in LLJit - #1424
Closed
matthiaskoenig wants to merge 1 commit into
Closed
matthiaskoenig wants to merge 1 commit into
matthiaskoenig wants to merge 1 commit into
Conversation
LLJit reused the object of a model compiled earlier in the process whenever the md5 of the SBML matched. The key did not hold the load options, so a model loaded with another LLJIT_OPTIMIZATION_LEVEL kept the code of the first level, and a model loaded with other options, e.g. MUTABLE_INITIAL_CONDITIONS, got code without the functions it needs and crashed. LOADSBMLOPTIONS_RECOMPILE did not prevent the reuse. getSBMLMD5 now returns a key of the md5 of the SBML, the load options except RECOMPILE (they include the JIT and its optimization level) and LOADSBMLOPTIONS_PERMISSIVE, which the code generation reads. The model cache of the LLVMModelGenerator and the object cache of LLJit use it, and the copy of getSBMLMD5 in the LLVMModelGenerator is gone. Each LLJit has its own object cache in front of the shared one: with RECOMPILE it compiles the module instead of looking for it, and it keeps the object of its model, which saveState uses instead of looking up the shared cache, where another model may have replaced it. The shared cache holds shared objects and locks its lookups too. Fixes sys-bio#1420.
|
Recreated in #1440. |
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.
LLJit reused the object of a model compiled earlier in the process
whenever the md5 of the SBML matched. The key did not hold the load
options, so a model loaded with another LLJIT_OPTIMIZATION_LEVEL kept
the code of the first level, and a model loaded with other options,
e.g. MUTABLE_INITIAL_CONDITIONS, got code without the functions it
needs and crashed. LOADSBMLOPTIONS_RECOMPILE did not prevent the reuse.
getSBMLMD5 now returns a key of the md5 of the SBML, the load options
except RECOMPILE (they include the JIT and its optimization level) and
LOADSBMLOPTIONS_PERMISSIVE, which the code generation reads. The model
cache of the LLVMModelGenerator and the object cache of LLJit use it,
and the copy of getSBMLMD5 in the LLVMModelGenerator is gone. Each LLJit
has its own object cache in front of the shared one: with RECOMPILE it
compiles the module instead of looking for it, and it keeps the object
of its model, which saveState uses instead of looking up the shared
cache, where another model may have replaced it. The shared cache holds
shared objects and locks its lookups too.
Fixes #1420.
With develop, this crashes in the second
RoadRunnerwith "Could not find symbol getFloatingSpeciesAmount", and works with this change:The script of #1420 now compiles the model three times, once for each load.