Skip to content

test: add regression test for CPU autocast device-type behavior#671

Open
khanfs wants to merge 1 commit intojwohlwend:mainfrom
khanfs:test/regression-checkpoint-and-autocast
Open

test: add regression test for CPU autocast device-type behavior#671
khanfs wants to merge 1 commit intojwohlwend:mainfrom
khanfs:test/regression-checkpoint-and-autocast

Conversation

@khanfs
Copy link
Copy Markdown

@khanfs khanfs commented Apr 13, 2026

Summary

Related to #662

Adds a focused regression test covering CPU autocast device-type behavior.

Inside a CPU autocast context, disabling autocast with device_type="cuda" does not actually disable CPU autocast, while disabling with device_type="cpu" does. This test captures that distinction explicitly.

Why

This helps preserve the intended fix direction discussed in the CPU autocast issue and protects against future regressions in precision-sensitive code paths.

Changes

  • add tests/test_autocast_precision.py
  • verify that torch.autocast("cuda", enabled=False) does not disable CPU autocast inside a CPU autocast context
  • verify that torch.autocast("cpu", enabled=False) does disable CPU autocast in that context

Notes

This PR adds regression coverage only. It does not change runtime behavior.

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