Add non-dup/known-size functionality to the lazy parser for cu optimization#352
Open
figaro-sol wants to merge 24 commits intoanza-xyz:mainfrom
Open
Add non-dup/known-size functionality to the lazy parser for cu optimization#352figaro-sol wants to merge 24 commits intoanza-xyz:mainfrom
figaro-sol wants to merge 24 commits intoanza-xyz:mainfrom
Conversation
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.
By letting the user inform the lazy account parser about whether the next account is known not to be a duplicate and if the size is known, users can get much better code generation. llvm is rather bad at propagating 'if condition then unreachable_unchecked' backwards. For example, in the CU bench,
has at best marginal effect on CUs of the updater (40->39 CUs). The asm generated for account parsing + size/signer includes many dup checks and full offset calculations like
and
The version using the new gates:
used only 26 CUs. The generated code fully constant-propagates the offset computation and removes dup checks giving
This change also adds assume-stye assertions about the alignment of the instruction data as part of the process. this helps libraries like bytemuck elide alignment checks.
Checked and unchecked variants of the dup/data gates are added as well. the checked variants still provide a significant performance improvement since the compiler can usually infer account offsets with the check in place.
I've included the cu benchmark code I used into the PR. not sure if it's desired or not, happy to remove.