|
15 | 15 | class TestSpecDBOperationsMPS(BaseSpecDBTest):
|
16 | 16 | """Test class for validating all specs in SpecDB using gen_errors on MPS."""
|
17 | 17 |
|
| 18 | + SKIP_OPS = [ |
| 19 | + # Calibrate specs (cpu not passing either): |
| 20 | + "addmm.default", |
| 21 | + "arange.default", |
| 22 | + "arange.start_step", |
| 23 | + "constant_pad_nd.default", |
| 24 | + "split_with_sizes_copy.default", |
| 25 | + # https://github.com/pytorch/pytorch/issues/160208 |
| 26 | + "add.Tensor", |
| 27 | + "add.Scalar", |
| 28 | + "rsub.Scalar", |
| 29 | + "sub.Tensor", |
| 30 | + "sub.Scalar", |
| 31 | + # crash: https://github.com/pytorch/pytorch/issues/154887 |
| 32 | + "_native_batch_norm_legit_no_training.default", |
| 33 | + # not implemented |
| 34 | + "_pdist_forward.default", |
| 35 | + # impl: clamp tensor number of dims must not be greater than that of input tensor |
| 36 | + "clamp.Tensor", |
| 37 | + # crash: https://github.com/pytorch/pytorch/issues/154881 |
| 38 | + "cumsum.default", |
| 39 | + # sparse_grad not supported in MPS yet |
| 40 | + "gather.default", |
| 41 | + # Dimension specified as -1 but tensor has no dimensions |
| 42 | + "index_select.default", |
| 43 | + # crash: https://github.com/pytorch/pytorch/issues/154882 |
| 44 | + "max_pool2d_with_indices.default", |
| 45 | + # On-going issue on MPSGraph topk when ndims() - axis > 4, see issue #154890 |
| 46 | + # https://github.com/pytorch/pytorch/issues/154890 |
| 47 | + "topk.default", |
| 48 | + # var_mps: reduction dim must be in the range of input shape |
| 49 | + "var.correction", |
| 50 | + "var.dim", |
| 51 | + ] |
| 52 | + |
18 | 53 | def test_all_ops_mps(self):
|
19 |
| - skip_ops = [ |
20 |
| - # Calibrate specs (cpu not passing either): |
21 |
| - "addmm.default", |
22 |
| - "arange.default", |
23 |
| - "arange.start_step", |
24 |
| - "constant_pad_nd.default", |
25 |
| - "split_with_sizes_copy.default", |
26 |
| - # https://github.com/pytorch/pytorch/issues/160208 |
27 |
| - "add.Tensor", |
28 |
| - "add.Scalar", |
29 |
| - "rsub.Scalar", |
30 |
| - "sub.Tensor", |
31 |
| - "sub.Scalar", |
32 |
| - # crash: https://github.com/pytorch/pytorch/issues/154887 |
33 |
| - "_native_batch_norm_legit_no_training.default", |
34 |
| - # not implemented |
35 |
| - "_pdist_forward.default", |
36 |
| - # impl: clamp tensor number of dims must not be greater than that of input tensor |
37 |
| - "clamp.Tensor", |
38 |
| - # crash: https://github.com/pytorch/pytorch/issues/154881 |
39 |
| - "cumsum.default", |
40 |
| - # sparse_grad not supported in MPS yet |
41 |
| - "gather.default", |
42 |
| - # Dimension specified as -1 but tensor has no dimensions |
43 |
| - "index_select.default", |
44 |
| - # crash: https://github.com/pytorch/pytorch/issues/154882 |
45 |
| - "max_pool2d_with_indices.default", |
46 |
| - # On-going issue on MPSGraph topk when ndims() - axis > 4, see issue #154890 |
47 |
| - # https://github.com/pytorch/pytorch/issues/154890 |
48 |
| - "topk.default", |
49 |
| - # var_mps: reduction dim must be in the range of input shape |
50 |
| - "var.correction", |
51 |
| - "var.dim", |
52 |
| - ] |
| 54 | + config = TensorConfig( |
| 55 | + device="mps", disallow_dtypes=[torch.float64], half_precision=False |
| 56 | + ) |
| 57 | + self._run_all_ops(config=config, skip_ops=self.SKIP_OPS) |
53 | 58 |
|
| 59 | + def test_all_ops_mps_half(self): |
| 60 | + skip_ops = self.SKIP_OPS.copy() |
54 | 61 | # ConvTranspose 3D with BF16 or FP16 types is not supported on MPS
|
55 | 62 | skip_ops += ["convolution.default"]
|
56 | 63 |
|
57 |
| - config = TensorConfig(device="mps", disallow_dtypes=[torch.float64]) |
| 64 | + config = TensorConfig( |
| 65 | + device="mps", disallow_dtypes=[torch.float64], half_precision=True |
| 66 | + ) |
58 | 67 | self._run_all_ops(config=config, skip_ops=skip_ops)
|
59 | 68 |
|
60 | 69 |
|
|
0 commit comments