Skip to content

div_trunk_rounding accuracy gap on float64 in test_ops_xpu.py #1895

@daisyden

Description

@daisyden

🐛 Describe the bug

Accuracy issue of div_trunk_rounding cases in test_ops_xpu.py

test_python_ref__refs_div_trunc_rounding_xpu_float64
test_python_ref_executor__refs_div_trunc_rounding_executor_aten_xpu_float64
test_python_ref_torch_fallback__refs_div_trunc_rounding_xpu_float64

Cases:
op_ut,third_party.torch-xpu-ops.test.xpu.test_ops_xpu.TestCommonXPU,test_python_ref__refs_div_trunc_rounding_xpu_float64
op_ut,third_party.torch-xpu-ops.test.xpu.test_ops_xpu.TestCommonXPU,test_python_ref_executor__refs_div_trunc_rounding_executor_aten_xpu_float64
op_ut,third_party.torch-xpu-ops.test.xpu.test_ops_xpu.TestCommonXPU,test_python_ref_torch_fallback__refs_div_trunc_rounding_xpu_float64

PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=16 PYTORCH_TEST_WITH_SLOW=1 pytest -v test_ops.py test_python_ref_torch_fallback__refs_div_trunc_rounding_xpu_float64

Traceback (most recent call last):
File "/home/daisyden/miniforge3/envs/test_ops/lib/python3.10/site-packages/torch-2.9.0a0+gitf3913ea-py3.10-linux-x86_64.egg/torch/testing/_internal/common_device_type.py", line 1135, in test_wrapper
return test(*args, **kwargs)
File "/home/daisyden/miniforge3/envs/test_ops/lib/python3.10/site-packages/torch-2.9.0a0+gitf3913ea-py3.10-linux-x86_64.egg/torch/testing/_internal/common_device_type.py", line 1451, in only_fn
return fn(self, *args, **kwargs)
File "/home/daisyden/miniforge3/envs/test_ops/lib/python3.10/site-packages/torch-2.9.0a0+gitf3913ea-py3.10-linux-x86_64.egg/torch/testing/_internal/common_utils.py", line 1665, in wrapper
fn(*args, **kwargs)
File "/home/daisyden/upstream/test_ops/third_party/torch-xpu-ops/test/xpu/../../../../test/test_ops.py", line 616, in test_python_ref_torch_fallback
self._ref_test_helper(contextlib.nullcontext, device, dtype, op)
File "/home/daisyden/upstream/test_ops/third_party/torch-xpu-ops/test/xpu/../../../../test/test_ops.py", line 518, in _ref_test_helper
raise e
File "/home/daisyden/upstream/test_ops/third_party/torch-xpu-ops/test/xpu/../../../../test/test_ops.py", line 506, in _ref_test_helper
self.assertEqual(
File "/home/daisyden/miniforge3/envs/test_ops/lib/python3.10/site-packages/torch-2.9.0a0+gitf3913ea-py3.10-linux-x86_64.egg/torch/testing/_internal/common_utils.py", line 4178, in assertEqual
raise error_metas.pop()[0].to_error( # type: ignore[index]
AssertionError: Tensor-likes are not close!

Mismatched elements: 4 / 100 (4.0%)
Greatest absolute difference: 1.0 at index (0,) (up to 1e-07 allowed)
Greatest relative difference: 1.0 at index (0,) (up to 1e-07 allowed)

Versions

torch 2.9.0a0+gitf3913ea
torch-xpu-ops: 0bc482b

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions