pytorch - 💡(How to fix) Fix Unify the definition and usage of skipOps [1 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#177257Fetched 2026-04-08 00:42:35
View on GitHub
Comments
0
Participants
1
Timeline
12
Reactions
0
Author
Participants
Timeline (top)
labeled ×4subscribed ×3mentioned ×2added_to_project_v2 ×1

Code Example

# New interface
def skipOps(to_skip):
    def wrapped(fn):
        fn._skipops = tuple(to_skip)
        return fn
    return wrapped

class ops(_TestParametrizer):
    def _parametrize_test(self, test, generic_cls, device_cls):
        self.update_skip_ops(test)  # New: Reads test._skipops and appends it to the decorator of the corresponding operation.
        ...

---

# Before
@suppress_warnings
@ops(_op_db, allowed_dtypes=(torch.float,))
@skipOps(
    _op_db,
    "TestLocalDTensorOps",
    "test_dtensor_op_db",
    dtensor_fails | dtensor_fails_no_strategy,
)
def test_dtensor_op_db(self, dtype, op):
    ...

# After
@suppress_warnings
@ops(_op_db, allowed_dtypes=(torch.float,))
@skipOps(
    dtensor_fails | dtensor_fails_no_strategy,
)
def test_dtensor_op_db(self, dtype, op):
    ...
RAW_BUFFERClick to expand / collapse

Unify the three existing skipOps variants (PyTorch / Functorch / DTensor), make them fully compatible with instantiate_device_type_tests, and improve the current usage of @skipOps.

# New interface
def skipOps(to_skip):
    def wrapped(fn):
        fn._skipops = tuple(to_skip)
        return fn
    return wrapped

class ops(_TestParametrizer):
    def _parametrize_test(self, test, generic_cls, device_cls):
        self.update_skip_ops(test)  # New: Reads test._skipops and appends it to the decorator of the corresponding operation.
        ...

Migrate all callers of @skipOps from the old version to the new version.

# Before
@suppress_warnings
@ops(_op_db, allowed_dtypes=(torch.float,))
@skipOps(
    _op_db,
    "TestLocalDTensorOps",
    "test_dtensor_op_db",
    dtensor_fails | dtensor_fails_no_strategy,
)
def test_dtensor_op_db(self, dtype, op):
    ...

# After
@suppress_warnings
@ops(_op_db, allowed_dtypes=(torch.float,))
@skipOps(
    dtensor_fails | dtensor_fails_no_strategy,
)
def test_dtensor_op_db(self, dtype, op):
    ...

cc @mruberry

extent analysis

Fix Plan

To unify the skipOps variants and make them compatible with instantiate_device_type_tests, follow these steps:

  • Update the skipOps decorator to the new interface
  • Migrate all callers of @skipOps from the old version to the new version

Code Changes

# New skipOps decorator
def skipOps(to_skip):
    def wrapped(fn):
        fn._skipops = tuple(to_skip)
        return fn
    return wrapped

# Update ops class to read test._skipops
class ops(_TestParametrizer):
    def _parametrize_test(self, test, generic_cls, device_cls):
        self.update_skip_ops(test)  # Reads test._skipops and appends it to the decorator of the corresponding operation.
        ...

# Example migration of @skipOps callers
# Before
@suppress_warnings
@ops(_op_db, allowed_dtypes=(torch.float,))
@skipOps(
    _op_db,
    "TestLocalDTensorOps",
    "test_dtensor_op_db",
    dtensor_fails | dtensor_fails_no_strategy,
)
def test_dtensor_op_db(self, dtype, op):
    ...

# After
@suppress_warnings
@ops(_op_db, allowed_dtypes=(torch.float,))
@skipOps(
    dtensor_fails | dtensor_fails_no_strategy,
)
def test_dtensor_op_db(self, dtype, op):
    ...

Verification

Verify that the fix worked by checking that tests using the new @skipOps decorator are correctly skipped.

Extra Tips

  • Make sure to update all callers of @skipOps to use the new interface.
  • Test the changes thoroughly to ensure that the new @skipOps decorator is working as expected.

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