Repository: pytorch
Issue: Some float16 inputs to CPU matmul are supported, others aren't
Labels: triaged,module: half,module: linear algebra

## 🐛 Bug

This occurs during porting of matmul to OpInfo #55543. 
1. If float16 is included in the dtypes list, the following error occurs in test result
```
======================================================================
ERROR: test_supported_backward_matmul_cpu_float16 (__main__.TestOpInfoCPU)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 297, in instantiated_test
    raise rte
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 292, in instantiated_test
    result = test_fn(self, *args)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 266, in test_wrapper
    return test(*args, **kwargs)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 730, in only_fn
    return fn(self, device, *args, **kwargs)
  File "test/test_ops.py", line 74, in test_supported_backward
    result = op(sample.input, *sample.args, **sample.kwargs)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_methods_invocations.py", line 233, in __call__
    return self.op(*args, **kwargs)
RuntimeError: "addmv_impl_cpu" not implemented for 'Half'

======================================================================
ERROR: test_supported_dtypes_matmul_cpu_float16 (__main__.TestOpInfoCPU)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 297, in instantiated_test
    raise rte
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 292, in instantiated_test
    result = test_fn(self, *args)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 266, in test_wrapper
    return test(*args, **kwargs)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 730, in only_fn
    return fn(self, device, *args, **kwargs)
  File "test/test_ops.py", line 56, in test_supported_dtypes
    op(sample.input, *sample.args, **sample.kwargs)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_methods_invocations.py", line 233, in __call__
    return self.op(*args, **kwargs)
RuntimeError: "addmv_impl_cpu" not implemented for 'Half'
```

2. If float16 is excluded from the dtypes test list, the following error also occurs:
```
======================================================================
FAIL: test_unsupported_dtypes_matmul_cpu_float16 (__main__.TestOpInfoCPU)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 292, in instantiated_test
    result = test_fn(self, *args)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 266, in test_wrapper
    return test(*args, **kwargs)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 582, in dep_fn
    return fn(slf, device, *args, **kwargs)
  File "/home/rongr/local/pytorch/torch/testing/_internal/common_device_type.py", line 730, in only_fn
    return fn(self, device, *args, **kwargs)
  File "test/test_ops.py", line 46, in test_unsupported_dtypes
    op(sample.input, *sample.args, **sample.kwargs)
AssertionError: RuntimeError not raised
```

This seems to indicate matmul on CPU for float16 both worked and did not worked at the same time?





cc @jianyuh @nikitaved @pearu @mruberry @heitorschueroff @walterddr @IvanYashchuk