Enable Paged Optimizer Support for XPU#1898
Open
jiqing-feng wants to merge 14 commits intobitsandbytes-foundation:mainfrom
Open
Enable Paged Optimizer Support for XPU#1898jiqing-feng wants to merge 14 commits intobitsandbytes-foundation:mainfrom
jiqing-feng wants to merge 14 commits intobitsandbytes-foundation:mainfrom
Conversation
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Contributor
Author
|
Hi @matthewdouglas . I have enabled paged optimizer for XPU. The xpu legend could be updated to full support after this PR is merged. Please review it. Thanks! |
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
|
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. |
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.
Summary
Add paged optimizer support for Intel XPU devices using SYCL Unified Shared Memory (USM), enabling
PagedAdamW,PagedAdam, andPagedLionon XPU. This brings feature parity with CUDA's paged optimizer implementation based oncudaMallocManaged.Changes
C++ (
csrc/pythonInterface.cpp)cget_managed_ptr,cprefetch,cfill_fp32,cfill_uint8for XPU using SYCL USM APIs (sycl::malloc_shared,queue.prefetch,queue.fill)Python
bitsandbytes/cextension.py: AddXpuBNBNativeLibraryclass to properly set ctypes return types for the new XPU symbolsbitsandbytes/functional.py: Make device synchronization device-agnostic (CUDA/XPU) and renamecuda_ptr→managed_ptrbitsandbytes/backends/triton/ops.py: Fix device context in optimizer wrappers to useg.deviceinstead ofstate1.device(paged state tensors appear as CPU tensors)tests/test_optim.py: Remove XPU paged optimizer skipExamples (
examples/xpu/)paged_xpu_training.py: Real training case with LLaMA + Alpaca datasetbenchmark_paged_memory.py: Memory benchmark showing ~65% GPU memory reduction with paged optimizersTest Results
Paged optimizer reduces GPU memory by 65.9% (2524 MB → 861 MB) on a ~220M parameter LLaMA model by offloading optimizer states to USM shared memory.
How to Verify