Skip to content

fix: remove dead gradient norm fallback - #8411

Open
LOGO127 wants to merge 1 commit into
deepspeedai:masterfrom
LOGO127:codex/deepspeed-8371-grad-norm
Open

fix: remove dead gradient norm fallback#8411
LOGO127 wants to merge 1 commit into
deepspeedai:masterfrom
LOGO127:codex/deepspeed-8371-grad-norm

Conversation

@LOGO127

@LOGO127 LOGO127 commented Sep 4, 2026

Copy link
Copy Markdown

Summary

Fixes #8371.

set_norm_for_param_grad_in_gpu previously fell back to param.grad when the
configured gradient attribute was None. That fallback is invalid for the
grad_accum path because the source gradient has already been moved and
cleared. The method now uses the selected attribute directly and reports a
clear assertion if the required gradient is missing.

Tests

  • pre-commit run --files deepspeed/runtime/zero/stage_1_and_2.py tests/unit/v1/zero/test_zero.py
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 py -3 -m pytest -q tests/unit/v1/zero/test_zero.py::TestSetNormForParamGradInGPU (3 passed)
  • py -3 -m compileall -q deepspeed/runtime/zero/stage_1_and_2.py tests/unit/v1/zero/test_zero.py
  • git diff --check

The regression test covers both configured gradient attributes and verifies
that the stale param.grad fallback is not used.

AI assistance was used for drafting and local validation; I reviewed the
implementation and take responsibility for the submitted changes.

Signed-off-by: luozijian <luozijian0924@gamil.com>
@LOGO127

LOGO127 commented Sep 4, 2026

Copy link
Copy Markdown
Author

The latest remote validation completed successfully: modal-torch-latest / collect tests, modal-torch-latest / DeepSpeedAI CI, and DCO all passed. The focused CPU regression tests and local pre-commit checks also pass; this PR is ready for maintainer review.

@LOGO127

LOGO127 commented Sep 4, 2026

Copy link
Copy Markdown
Author

Gentle follow-up on #8371: the focused CPU regression, pre-commit checks, DCO, and the remote modal-torch-latest validation remain green. The PR is still mergeable and ready for maintainer review. Please let me know if any additional coverage or adjustment is preferred.

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.

[BUG] set_norm_for_param_grad_in_gpu's grad_accum fallback is dead in both accumulation modes

1 participant