Add kernel registration for 8bit and 32bit optimizers#1706
Merged
matthewdouglas merged 11 commits intobitsandbytes-foundation:mainfrom Jul 14, 2025
Merged
Add kernel registration for 8bit and 32bit optimizers#1706matthewdouglas merged 11 commits intobitsandbytes-foundation:mainfrom
matthewdouglas merged 11 commits intobitsandbytes-foundation:mainfrom
Conversation
Contributor
Author
|
@matthewdouglas The PR is ready for review |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
matthewdouglas
requested changes
Jul 14, 2025
Closed
Comment on lines
+212
to
+213
| # allow up to 15 errors for Lion | ||
| assert_most_approx_close(p1, p2.float(), atol=atol, rtol=rtol, max_error_count=15) |
Member
There was a problem hiding this comment.
I'm OK with this, although the tests passed as they were for me on T4, RTX 4090 and L40S.
Contributor
Author
|
@matthewdouglas I updated schema to describe all mutable arguments and default arguments. Ready for the second round of review. Optimizer tests still pass, I checked on torch==2.5 |
matthewdouglas
approved these changes
Jul 14, 2025
Member
|
LGTM, thanks for taking care of this! |
941681d
into
bitsandbytes-foundation:main
39 checks passed
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.
Add new kernel
bitsandbytes::optimizer_update_8bit_blockwisefor 8bit optimizers andbitsandbytes::optimizer_update_32bitfor 32bit optimizers. I'm not 100% sure about using a dictionary in a cudaops.py. I could replace it with a lot of branching (5optimizers * 3 dtypes) if that's preferable.This kernel registration is necessary for #1692
I also added option to skip cpu from the list of available devices to test properly and simplify testing of GPU-only kernels.
I run tests on cuda, they passed locally on RTX 4070, except for 1 optimizer.
The only issue was 32bit test for Lion optimizer. I retested on the main branch, and there was the same error. Also, this commit doesn't change the implementation. So I increased tolerance in the test, maybe the issue only appears on some client devices, like RTX 4070. With this PR all tests passed.
Traceback: