Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weight Hooks Switching Optimization #7067

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kosinkadink
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant