Weight Hooks Switching Optimization #7067
Open
+17
−6
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.
When hook weights are cached after calculation, there is no need to revert all weights back to their backup values in
hook_backup
before switching to them. After they are swapped,hook_backup
weights should only be restored for keys that weren't swapped to cached weights.When both cached weights and backup weights are stored on the
load_device
, there is a 1.07x uplift in performance when any is found.When some of the cached weights/backup weights are forced to be offloaded to system memory, there is a 1.12x uplift in performance when any is found.
I didn't find any performance regressions, so it should be an overall improvement.