Skip to content

Fix unit tests failure on CPU with fp16 support - #9086

Merged
hwchen2017 merged 2 commits into
masterfrom
hongwei/fix_cpu_ut
Nov 15, 2026
Merged

hwchen2017 merged 2 commits into
masterfrom
hongwei/fix_cpu_ut

Conversation

@hwchen2017

Copy link
Copy Markdown
Contributor

On runners whose CPU supports oneDNN fp16 (Sapphire Rapids or newer), fp16 tests that normally skip start running, and Muon's Newton-Schulz switches to fp16. cpu-torch-latest-v1-multirank then fails 10 tests, e.g. runs 43556673085 and 43396382279 (identical values). All fixes are test-only:

  • tests/unit/v1/zero/test_zero_autocast.py (8 tests): the baseline torch.amp.GradScaler() defaults to CUDA and disables itself on CPU, so the baseline trained fp16 without loss scaling. It is now created on get_accelerator().device_name(); CUDA is unchanged.
  • tests/unit/v1/ops/muon/test_muon_overflow.py (2 tests): ZeRO-0 and ZeRO-1/2 run fp16 Newton-Schulz through different compiled graphs, which land ~1e-3 apart. Since that comes from the code under test, the bound is now derived from ns_compute_dtype("gram"): 1e-5 for fp32 as before, 7.8e-3 for fp16 (also on CUDA, where it was bit-exact). The test still catches the Stage Muon's momentum once per partition in ZeRO-1/2 #8633 bug, which moves matrices 2e-2 to 3.5e-2 away from ZeRO-0.
  • tests/unit/v1/zero/test_zero.py (TestGradientAllreduceOpTraining, 2 Muon cases, not hit by CI today): SUM halves an unscaled fp16 loss, which rounds subnormal gradients, and Newton-Schulz grows that past the tolerance. It fails on torch 2.10 and in 6 of 32 seeded runs on 2.14. A static loss_scale of 1024 makes MEAN and SUM bit-identical in all 32; the tolerance is unchanged.

@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added the skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. label Nov 14, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T18:10:44.296301Z 8776737 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@auto-pr-labeler-with-jev auto-pr-labeler-with-jev Bot added skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. and removed skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU. labels Nov 15, 2026
@hwchen2017
hwchen2017 added this pull request to the merge queue Nov 15, 2026
Merged via the queue into master with commit 489c20a Nov 15, 2026
21 of 22 checks passed
@hwchen2017
hwchen2017 deleted the hongwei/fix_cpu_ut branch November 15, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-gpu-test Requires positive evidence that every changed behavior can be validated without a GPU.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants