Zero3 defragment utility (#7940)
refactor(zero3): factor out defragment method to zero utils
Resolves a TODO in the codebase by extracting the `defragment` logic out
of `DeepSpeedZeroOptimizer_Stage3` and moving it to
`deepspeed/runtime/zero/utils.py`
as an independent utility function. This decouples the memory
defragmentation logic
from the core optimizer class and improves code maintainability and
reusability.
---------
Signed-off-by: nathon-lee <leejianwoo@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nathon-lee <248585198+nathon-lee@users.noreply.github.com>