intel / intel/torch-xpu-ops

[BMG] TestInductorDynamicXPU.test_coalescing_analysis_sympy_is_constant fails: Tensor-likes are not close (regression)

Open
#4,237 3 comments 0 reactions 1 assignee Claimed by @ZhaoqiongZ View on GitHub
agent:needs-human bug module: inductor test: ut
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 13h
Merged PRs (30d)
107

Description

## Description

`test_coalescing_analysis_sympy_is_constant` (`TestInductorDynamicXPU`, `test/inductor/test_torchinductor_dynamic_shapes.py`) fails on XPU with a REGRESSION (`last_status_xpu` was `passed`, now `failed`):

```
AssertionError: Tensor-likes are not close!
Mismatched elements: 660 / 46400 (1.4%)
Greatest absolute difference: 0.06640625 at index (14, 42, 18) (up to 0.01 allowed)
```

## Root cause investigation

- Base method confirmed present at `test_torchinductor_dynamic_shapes.py:1404` (introducing commit `c744313694b`, ancestor of HEAD), instantiated with `allow_xpu=True` (`test_torchinductor_dynamic_shapes.py:1476`) — not a community change.
- **Possible lead**: this test was originally written to catch a bug where sympy's `is_constant()` triggers numerical evaluation causing assertion errors in a custom `Mod` function. Two recent upstream commits changed several inductor sites from `is_constant()` to `is_number()`:
- `0a9819e3e1c` ("Prefer is_number over is_constant()") — touches `torch/_inductor/lowering.py`, `torch/_inductor/optimize_indexing.py`, `torch/utils/_sympy/value_ranges.py`.
- `718035791d8` ("Prefer `e.is_number` over `not e.free_symbols` in SymPy").

This is a plausible but **unconfirmed** root-cause lead, not proof — the test itself was not renamed/removed (so it is not a "community change" per the classify-ut cascade), but the *behavior* the test exercises may have shifted due to these commits. Worth checking during investigation.
- No tracking issue found in `pytorch/pytorch` or `intel/torch-xpu-ops` for this specific test or the `is_constant`/`is_number` sympy behavior change on XPU.

## Reproduction

```
python -m pytest "test/inductor/test_torchinductor_dynamic_shapes.py::TestInductorDynamicXPU::test_coalescing_analysis_sympy_is_constant_xpu" -v
```

## Environment

- torch: 2.13.0+xpu
- Sheet: `XPU skipped only Inductor`, row 2401 in `release-2.13-bmg-2.xlsx`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.