Developer Tools

PyTorch fixes decorator ordering bug in GPU test skipping

A subtle decorator reversal prevents silent failures in CI tests.

Deep Dive

The PyTorch team has merged a critical fix (PR #191039) addressing a decorator ordering bug in test composability. The issue involved the GPU-count skip decorator being applied before the sandcastle silent-pass decorator on four specific tests. This incorrect order caused workers with fewer GPUs to exit prematurely without triggering the silent pass, leading to false failures in CI pipelines. The fix reverses the decorator order, ensuring that sandcastle workers with insufficient GPUs correctly skip the test and report a silent pass rather than failing.

Authored with assistance from Codex, an AI assistant from OpenAI, the change was deliberately kept at the call sites to avoid modifying the shared skip behavior that other tests rely on. This targeted approach minimizes risk while resolving a subtle but disruptive CI issue. Approved by reviewers weifengpy and sanketpurandare, the fix underscores the importance of decorator composition in large-scale test suites. For developers relying on PyTorch's CI, this ensures more reliable test results across diverse GPU environments, from local workstations to cloud clusters.

Key Points
  • The bug caused short-GPU Sandcastle workers to fail silently instead of skipping tests, breaking CI reliability.
  • Fix reverses order of GPU-count skip and sandcastle silent-pass decorators on four affected tests.
  • Change localized to call sites to avoid altering shared skip behavior used by other tests.

Why It Matters

Ensures reliable CI test outcomes for PyTorch across different GPU configurations, reducing false failures.

📬 Get the top 10 AI stories daily