Skip to content

Forced float32 grad scaler test: gate on has_real_cuda (CPU studio red since #18065) - #18091

Merged
danielhanchen merged 1 commit into
mainfrom
ci-grad-scaler-real-cuda-guard
Nov 17, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci-grad-scaler-real-cuda-guard

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Repo tests (CPU, studio) fails on main since #18065 (seen on the staging run for #18082):

tests/python/test_accelerator_skip_guards.py::test_no_skip_guard_reads_a_spoofable_accelerator_probe
AssertionError: these skip guards read a probe tests/_zoo_aggressive_cuda_spoof.py patches to True process-wide ...
    test_forced_float32_grad_scaler.py:92: torch.cuda.is_available()
    test_forced_float32_grad_scaler.py:117: torch.cuda.is_bf16_supported()
    test_forced_float32_grad_scaler.py:190: torch.cuda.is_available()

#18065 added tests/test_forced_float32_grad_scaler.py with three GPU tests guarded by torch.cuda.is_available(). The CUDA spoof used by the zoo suite makes that probe return True for the whole pytest session, so on a CPU runner these tests would un-skip and fail whenever they share a session with it. The repo guard catches exactly that and asks for has_real_cuda().

The GradScaler change in #18065 is fine; only the new test's skip guards miss the convention.

Change

tests/test_forced_float32_grad_scaler.py gates its three GPU tests on has_real_cuda() from tests/_shared/real_accelerator.py, as the other GPU tests do. The bfloat16 case keeps torch.cuda.is_bf16_supported() behind it (has_real_cuda() and torch.cuda.is_bf16_supported()), which the guard accepts. On a real CUDA box the gates resolve the same as before.

Verification

  • tests/python/test_accelerator_skip_guards.py: 1 failed on main (the lines above), 24 passed with this change.
  • tests/test_forced_float32_grad_scaler.py on a CPU host: 3 skipped, with the same reasons as before.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 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-17T06:15:24.585657Z 4858a4d Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 4858a4df84

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit d247fb1 into main Nov 17, 2026
@danielhanchen
danielhanchen deleted the ci-grad-scaler-real-cuda-guard branch November 17, 2026 06:25
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.

1 participant