pytorch - ✅(Solved) Fix DISABLED test_aoti_debug_printer_works_on_constants (__main__.TestGpuWrapper) [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#178857Fetched 2026-04-08 01:57:36
View on GitHub
Comments
1
Participants
2
Timeline
56
Reactions
0
Author
Timeline (top)
mentioned ×21subscribed ×21labeled ×7referenced ×3

Root Cause

This test was disabled because it is failing on main branch (recent examples).

PR fix notes

PR #178959: [xpu][fix] Fix DeviceOpOverrides registered incorrectly

Description (problem / solution / changelog)

Stack from ghstack (oldest at bottom):

  • #178986
  • -> #178959

Motivation

The current initialization logic for DeviceOpOverrides relies on checking whether device_op_overrides_dict is empty:

def get_device_op_overrides(device: str) -> DeviceOpOverrides:
    assert isinstance(device, str), type(device)

    if not device_op_overrides_dict:
        from . import (  # noqa: F401  # noqa: F401
            cpu_device_op_overrides,
            mps_device_op_overrides,
        )
        from .cuda import device_op_overrides  # noqa: F401
        from .mtia import device_op_overrides as mtia_op_overrides  # noqa: F401
        from .xpu import device_op_overrides as xpu_op_overrides  # noqa: F401

    if device not in device_op_overrides_dict:
        # For backends like TPU that only need no-op overrides (Pallas handles codegen)
        from .cpu_device_op_overrides import CpuDeviceOpOverrides

        register_device_op_overrides(device, CpuDeviceOpOverrides())

    return device_op_overrides_dict[device]

This approach is fragile because it assumes no overrides are registered prior to calling get_device_op_overrides. However, if register_device_op_overrides is invoked independently (e.g., in tests or other modules), the dictionary may become partially populated before full initialization occurs.

In such cases, the lazy initialization block is skipped, and some backends (e.g., XPU) never register their corresponding DeviceOpOverrides. As a result, the system silently falls back to CpuDeviceOpOverrides, leading to incorrect behavior.

This issue has already caused multiple failures in XPU CI, particularly in test_gpu_cpp_wrapper.py. For example, PR #175385 unintentionally registers CUDADeviceOpOverrides early, making device_op_overrides_dict non-empty and preventing XPU overrides from being registered.

The silent fallback to CPU overrides makes these issues difficult to detect and debug.

Solution

To make initialization robust and deterministic, introduce a dedicated flag _device_op_overrides_initialized to explicitly track whether all device overrides have been fully registered.

Additional Context

fix https://github.com/pytorch/pytorch/issues/178857 fix https://github.com/pytorch/pytorch/issues/178761 fix https://github.com/pytorch/pytorch/issues/178753 fix https://github.com/pytorch/pytorch/issues/178855, etc...

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

Changed files

  • torch/_inductor/codegen/common.py (modified, +19/-14)
RAW_BUFFERClick to expand / collapse

Platforms: xpu

This test was disabled because it is failing on main branch (recent examples).

cc @mruberry @chauhang @penguinwu @voznesenskym @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @aakhundov @coconutruben @jataylo @gujinghui @fengyuan14

extent analysis

TL;DR

The test test_aoti_debug_printer_works_on_constants in test_gpu_cpp_wrapper.py needs to be re-enabled and fixed to resolve the failure on the main branch.

Guidance

  • Review the recent failure examples on torch-ci.com to understand the nature of the test failure.
  • Investigate the test_aoti_debug_printer_works_on_constants test in test_gpu_cpp_wrapper.py to identify the root cause of the failure.
  • Consider re-enabling the test and running it locally to reproduce and debug the issue.
  • Check if there are any recent changes in the code that could be causing the test to fail.

Notes

The provided information does not include specific details about the failure, so a more detailed analysis of the test and the recent changes in the code is necessary to determine the root cause.

Recommendation

Apply workaround: Re-enable the test and debug it locally to identify the root cause of the failure, as the issue seems to be specific to the test_aoti_debug_printer_works_on_constants test.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING