NotImplementedError: "scatter_gather_base_kernel_func" not implemented for 'ComplexDouble' in test_masked.py
- Dominant language
- Python
- Stars
- 113
- Forks
- 129
- Avg merge
- 5d 9h
- Merged PRs (30d)
- 112
Description
### 🐛 Describe the bug
`NotImplementedError: "scatter_gather_base_kernel_func" not implemented for 'ComplexDouble'` occurred when enable xpu in upstream pytorch ut test_masked.py
Error log
```
________________________ TestMaskedXPU.test_mask_layout_sparse_coo_masked_prod_xpu_complex128 _________________________
Traceback (most recent call last):
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/unittest/case.py", line 59, in testPartExecutor
yield
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/unittest/case.py", line 591, in run
self._callTestMethod(testMethod)
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/unittest/case.py", line 549, in _callTestMethod
method()
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 3590, in wrapper
method(*args, **kwargs)
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_device_type.py", line 647, in instantiated_test
raise rte
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_device_type.py", line 627, in instantiated_test
result = test(self, **param_kwargs)
File "/home/sdp/libohao/test_upstream/pytorch/test/test_masked.py", line 260, in wrap
test(self, layout, device, dtype, op, sample_inputs_generator())
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 1933, in wrapper
fn(*args, **kwargs)
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_device_type.py", line 1463, in test_wrapper
raise e
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_device_type.py", line 1450, in test_wrapper
return test(*args, **kwargs)
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_device_type.py", line 1795, in only_fn
return fn(self, *args, **kwargs)
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 2675, in wrapper
fn(*args, **kwargs)
File "/home/sdp/libohao/test_upstream/pytorch/test/test_masked.py", line 304, in test_mask_layout
actual = op.op(t_inp, *t_args, **t_kwargs)
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/masked/_ops.py", line 1166, in prod
return _sparse_coo_scatter_reduction_helper(
File "/home/sdp/miniforge3/envs/libo_nightly/lib/python3.10/site-packages/torch/masked/_ops.py", line 742, in _sparse_coo_scatter_reduction_helper
new_values = out.scatter_reduce_(
NotImplementedError: "scatter_gather_base_kernel_func" not implemented for 'ComplexDouble'
To execute this test, run the following from the base repo dir:
python test/test_masked.py TestMaskedXPU.test_mask_layout_sparse_coo_masked_prod_xpu_complex128
This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0
```
Reproducer:
```
pytest -v test_masked_xpu.py -k test_mask_layout_sparse_coo_masked_prod_xpu_complex128
pytest -v test_masked_xpu.py -k test_mask_layout_sparse_coo_masked_prod_xpu_complex64
```
### Versions
Pytorch wheel - 2.14.0.dev20260712+xpu (commit: 33419e59913110a85b9be27777c5dbc8ad488c53)
Related PR: https://github.com/pytorch/pytorch/pull/189683
Contributor guide
Research direction
Start with test/test_masked.py, focusing on TestMaskedXPU.test_mask_layout and the complex64/complex128 sparse COO masked prod cases. Trace the failing call through torch/masked/_ops.py to _sparse_coo_scatter_reduction_helper and scatter_reduce_. Done means both listed pytest reproducer commands complete without the ComplexDouble or complex-type NotImplementedError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100