Fix: Handle FusedLAMB Fails with LowLevelZeroPlugin When Using CPU Offload#6418
Open
Truong5724 wants to merge 3 commits intohpcaitech:mainfrom
Open
Fix: Handle FusedLAMB Fails with LowLevelZeroPlugin When Using CPU Offload#6418Truong5724 wants to merge 3 commits intohpcaitech:mainfrom
Truong5724 wants to merge 3 commits intohpcaitech:mainfrom
Conversation
for more information, see https://pre-commit.ci
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.
📌 Checklist before creating the PR
[doc/gemini/tensor/...]: A concise descriptionpip install pre-commit && pre-commit install🚨 Issue number
Fixed #6401
📝 What does this PR do?
Problem
LowLevelZeroPluginwith CPU offload and theFusedLAMBoptimizer, training fails during the optimizer step with the following error:multi_tensor_applierduring gradient norm computation:This issue only appears when CPU offload is enabled. Under normal GPU execution,
FusedLAMBworks correctly.The root cause is that when CPU offload is used, optimizer states and gradients may reside on CPU, while
FusedLAMBrelies on fused CUDA kernels that require all input tensors to be on GPU.However,
multi_tensor_applierdoes not enforce or validate device placement before launching CUDA kernels, leading to a device mismatch error at runtime.Solution
To ensure compatibility with CPU offload, this PR ensures that all tensors passed to
multi_tensor_applierare moved to CUDA before kernel execution.Updated
MultiTensorApply.__call__inmulti_tensor_apply.py:Implication
FusedLAMBworks correctly withLowLevelZeroPluginwhen CPU offload is enabled.Verification
LowLevelZeroPlugin+ CPU offload.FusedLAMBoptimizer.expected input to be on cudaerrors.💥 Checklist before requesting a review
⭐️ Do you enjoy contributing to Colossal-AI?