intel / intel/torch-xpu-ops

[release/2.14] [Bug Skip]: UT failed with error torch-xpu-ops.test.xpu.functorch.test_ac_xpu.MemoryBudgetTest. test_attention_vs_linear AssertionError: Scalars are not close!

Open
#4,729 0 comments 0 reactions 0 assignees View on GitHub
os: Windows skipped test: ut wontfix
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 9h
Merged PRs (30d)
112

Description

### 🐛 Describe the bug with skip template

## Description
The test `MemoryBudgetTest.test_attention_vs_linear` is failing due to a scalar mismatch in memory budget estimation on XPU.

## Skipped cases with dynamic template
Cases:
op_ut,third_party.torch-xpu-ops.test.xpu.functorch.test_ac_xpu.MemoryBudgetTest,test_attention_vs_linear

## Reproduce
```python
# Sample code to reproduce the problem
# PYTORCH_TEST_WITH_SLOW=1 python test/xpu/functorch/test_ac_xpu.py MemoryBudgetTest.test_attention_vs_linear
```

## Error message
```
Traceback (most recent call last):
File "/__w/torch-xpu-ops/torch-xpu-ops/pytorch/third_party/torch-xpu-ops/test/xpu/functorch/test_ac_xpu.py", line 377, in test_attention_vs_linear
try_seq_length(1, 1, "mm")
File "/__w/torch-xpu-ops/torch-xpu-ops/pytorch/third_party/torch-xpu-ops/test/xpu/functorch/test_ac_xpu.py", line 363, in try_seq_length
self.assertEqual(eager_mem, S * D * 2)
File "/tmp/xpu-tool/Python/3.10.20/x64/lib/python3.10/site-packages/torch/testing/_internal/common_utils.py", line 4809, in assertEqual
raise error_metas.pop()[0].to_error(
AssertionError: Scalars are not close!
Expected 2 but got 5.0.
Absolute difference: 3.0 (up to 1e-05 allowed)
Relative difference: 1.5 (up to 1.3e-06 allowed)

To execute this test, run the following from the base repo dir:
PYTORCH_TEST_WITH_SLOW=1 python test/xpu/functorch/test_ac_xpu.py MemoryBudgetTest.test_attention_vs_linear
```

# TODO XPU PR
https://github.com/intel/torch-xpu-ops/pull/4294

### Versions

PyTorch: main 2.14.0a0

Contributor guide

Open the contributing guide

Research direction

Run PYTORCH_TEST_WITH_SLOW=1 python test/xpu/functorch/test_ac_xpu.py MemoryBudgetTest.test_attention_vs_linear from the base repository and inspect the failing assertion around lines 363-377. Review the referenced XPU PR 4294 and determine why the eager memory value is 5.0 instead of the expected 2; done means the test passes without the skipped case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai-infra-agents, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.