Skip to content

Skip TypedStorage tests on XPU#3260

Open
BartoszKokoszko wants to merge 2 commits intointel:mainfrom
BartoszKokoszko:dev/bkokoszx/skip-TypedStorage-tests
Open

Skip TypedStorage tests on XPU#3260
BartoszKokoszko wants to merge 2 commits intointel:mainfrom
BartoszKokoszko:dev/bkokoszx/skip-TypedStorage-tests

Conversation

@BartoszKokoszko
Copy link
Copy Markdown
Contributor

TypedStorage is deprecated in PyTorch in favor of UntypedStorage paired with torch.dtype. XPU does not provide typed storage classes (e.g., torch.xpu.FloatStorage, torch.xpu.BFloat16Storage), so these tests cannot run on XPU.

Changes:

  • Add @unittest.skip decorators to TypedStorage-related tests in test_torch_xpu.py to align with skip_list_common.py entries
  • Update skip_list_common.py with detailed explanation referencing torch/storage.py:L563 where the TypedStorage deprecation is documented

Tests affected:

  • test_storage_setitem
  • test_storage_error
  • test_storage_error_no_attribute
  • test_typed_storage_deprecation_warning
  • test_typed_storage_internal_no_warning
  • test_tensor_storage_type
  • test_print

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Skips TypedStorage-related tests in the XPU test suite and documents why they’re not applicable, aligning test execution with the XPU skip lists.

Changes:

  • Added @unittest.skip annotations to TypedStorage-dependent tests in test_torch_xpu.py.
  • Expanded skip_list_common.py with a rationale for skipping TypedStorage tests on XPU.
  • Relaxed an XPU-specific GradScaler state-dict assertion to avoid relying on a typed XPU tensor class.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
test/xpu/test_torch_xpu.py Adds skips for TypedStorage tests and adjusts an XPU GradScaler assertion.
test/xpu/skip_list_common.py Adds skip entries and rationale for TypedStorage-related tests on XPU.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

TypedStorage is deprecated in PyTorch in favor of UntypedStorage paired
with torch.dtype. XPU does not provide typed storage classes (e.g.,
torch.xpu.FloatStorage, torch.xpu.BFloat16Storage), so these tests
cannot run on XPU.

Changes:
- Add @unittest.skip decorators to TypedStorage-related tests in
  test_torch_xpu.py to align with skip_list_common.py entries
- Update skip_list_common.py with detailed explanation referencing
  torch/storage.py:L563 where the TypedStorage deprecation is documented

Tests affected:
- test_storage_setitem
- test_storage_error
- test_storage_error_no_attribute
- test_typed_storage_deprecation_warning
- test_typed_storage_internal_no_warning
- test_tensor_storage_type
- test_print
@BartoszKokoszko BartoszKokoszko force-pushed the dev/bkokoszx/skip-TypedStorage-tests branch from e2f0a80 to cd4cff8 Compare April 8, 2026 13:43
@BartoszKokoszko BartoszKokoszko changed the title Skip TypedStorage tests on XPU and document rationale Skip TypedStorage tests on XPU Apr 8, 2026
Copy link
Copy Markdown
Contributor

@guangyey guangyey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your update!

Copilot AI review requested due to automatic review settings April 9, 2026 14:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +9458 to 9462
@unittest.skipIf(
TEST_XPU,
"TypedStorage is deprecated and not available on XPU. See skip_list_common.py for details.",
)
def test_typed_storage_internal_no_warning(self):
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new @unittest.skipIf(TEST_XPU, ...) skips this whole test whenever XPU is available, which also skips the CUDA coverage that this test includes via the torch.cuda.is_available() branch. If the goal is to skip only the XPU-typed-storage portion, consider guarding the XPU branch more narrowly (e.g., based on the presence of torch.xpu.FloatStorage) so CUDA behavior can still be exercised on systems that have both accelerators.

Copilot uses AI. Check for mistakes.
Comment on lines +9265 to 9269
@unittest.skipIf(
TEST_XPU,
"TypedStorage is deprecated and not available on XPU. See skip_list_common.py for details.",
)
def test_storage_error_no_attribute(self):
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With @unittest.skipIf(TEST_XPU, ...) added here, the if TEST_XPU: branch inside test_storage_error_no_attribute becomes unreachable. Consider removing the dead XPU branch (or replacing the decorator with a narrower capability/attribute check) to keep the test logic clear.

Copilot uses AI. Check for mistakes.
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.

4 participants