Skip to content

MPS does not support deterministic index operations #161029

@malfet

Description

@malfet

🐛 Describe the bug

See this for example

=====================================================================
FAIL: test_index_add_deterministic_mps (__main__.TestIndexingMPS.test_index_add_deterministic_mps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_utils.py", line 3224, in wrapper
    method(*args, **kwargs)
    ~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_device_type.py", line 426, in instantiated_test
    result = test(self, **param_kwargs)
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_device_type.py", line 1434, in only_fn
    return fn(self, *args, **kwargs)
  File "/Users/malfet/git/pytorch/pytorch/test/test_indexing.py", line 2016, in test_index_add_deterministic
    self.assertEqual(y, y0, atol=0, rtol=0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_utils.py", line 4179, in assertEqual
    raise error_metas.pop()[0].to_error(  # type: ignore[index]
    ...<4 lines>...
    )
AssertionError: Tensor-likes are not equal!

Mismatched elements: 3311 / 24000 (13.8%)
Greatest absolute difference: 7.62939453125e-06 at index (517, 2, 0)
Greatest relative difference: 2.5677587700556614e-07 at index (1388, 0, 0)

To execute this test, run the following from the base repo dir:
    python test/test_indexing.py TestIndexingMPS.test_index_add_deterministic_mps

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0

======================================================================
FAIL: test_index_copy_deterministic_mps (__main__.TestIndexingMPS.test_index_copy_deterministic_mps)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_utils.py", line 3224, in wrapper
    method(*args, **kwargs)
    ~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_device_type.py", line 426, in instantiated_test
    result = test(self, **param_kwargs)
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_device_type.py", line 1434, in only_fn
    return fn(self, *args, **kwargs)
  File "/Users/malfet/git/pytorch/pytorch/test/test_indexing.py", line 2003, in test_index_copy_deterministic
    self.assertEqual(x0, y0, atol=0, rtol=0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/malfet/git/pytorch/pytorch/torch/testing/_internal/common_utils.py", line 4179, in assertEqual
    raise error_metas.pop()[0].to_error(  # type: ignore[index]
    ...<4 lines>...
    )
AssertionError: Tensor-likes are not equal!

Mismatched elements: 24000 / 24000 (100.0%)
Greatest absolute difference: 0.9984288215637207 at index (1528, 2, 0)
Greatest relative difference: 93774.4921875 at index (1285, 3, 0)

To execute this test, run the following from the base repo dir:
    python test/test_indexing.py TestIndexingMPS.test_index_copy_deterministic_mps

This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0


Versions

nightly

cc @mruberry @kurtamohler @kulinseth @albanD @DenisVieriu97 @jhavukainen

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: determinismmodule: mpsRelated to Apple Metal Performance Shaders frameworktriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions