Repository navigation
Include DOLRECOMP_STATE_MEMORY in the codegen cache identity - #32
Closed
dougchansan wants to merge 1 commit into
Closed
dougchansan wants to merge 1 commit into
dougchansan wants to merge 1 commit into
Conversation
DolRecomp reads DOLRECOMP_STATE_MEMORY from the ambient environment and it changes the code it generates: state-in-memory keeps CPU state in CPUState instead of allocas, which produces a very different -- and roughly 3x smaller -- module. The variable was not in the cache key. Everything else that distinguishes the two builds is already keyed or identical, so two builds that differ only in this variable hash the same and the cache answers one with the other: arm backend DOLRECOMP_STATE_MEMORY llvm llvm 0 sim llvm 1 Same backend, same recompiler binary, same DOL. Before this change both produce the same identity string, because a name absent from the array contributes nothing. After it they separate, which is what the cache directory names show: llvm ...-3583cf731fa2e16c sim ...-f0315f9002dfe831 Nothing is contributed when the variable is unset, so a default environment keeps the cache entries it already has.
Contributor
|
Superseded by the --state-in-memory interface handled in #33. |
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.
DolRecomp reads
DOLRECOMP_STATE_MEMORYfrom the ambient environment and it changes the code it generates: state-in-memory keeps CPU state inCPUStateinstead of allocas, which produces a very different — and roughly 3× smaller — module. The variable was not in the cache key.Everything else that distinguishes such a pair of builds is already keyed or identical, so two builds that differ only in this variable hash to the same identity and the cache answers one with the other:
DOLRECOMP_STATE_MEMORYSame backend, same recompiler binary, same DOL.
backend=is already part of the identity string and is equal here, andDolRecompCodegenIdentity()contributes nothing for a name absent from the array — so before this change the two identities are byte-identical.After it they separate, which is what the cache directory names show:
Nothing is contributed when the variable is unset, so a default environment keeps the cache entries it already has and no existing module is invalidated.
This is the same class of bug the existing comment above the array describes for
DOLRECOMP_LLVM_CPU— a variable DolRecomp reads viagetenvthat changes generated code but did not reach the key.