pytorch - ✅(Solved) Fix DISABLED test_addmm_gpu_wrapper (__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#178855Fetched 2026-04-08 01:57:38
View on GitHub
Comments
1
Participants
2
Timeline
59
Reactions
0
Author
Timeline (top)
mentioned ×22subscribed ×22labeled ×8referenced ×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 @jbschlosser @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

  • Re-enable and re-run the disabled test test_addmm_gpu_wrapper to assess and potentially fix the failure on the main branch.

Guidance

  • Investigate the recent examples of test failures on torch-ci.com to identify patterns or common factors contributing to the test failure.
  • Review the test code in test_gpu_cpp_wrapper.py to ensure it is correctly implemented and compatible with the current main branch.
  • Consider reaching out to the listed contributors for additional insight or assistance in resolving the test failure.

Notes

  • The provided information lacks specific technical details about the failure, so a more detailed analysis or fix cannot be determined without further investigation.

Recommendation

  • Apply workaround: Re-enable the test and attempt to fix the underlying issue causing the failure, as the test is currently disabled and the root cause is unknown.

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