_flash_attention_forward not implemented for XPU — meta test failures
- Dominant language
- Python
- Stars
- 113
- Forks
- 129
- Avg merge
- 5d 9h
- Merged PRs (30d)
- 112
Description
Cases:
op_ut,third_party.torch-xpu-ops.test.xpu.test_meta_xpu.TestMetaXPU,test_dispatch_symbolic_meta_outplace_torch_ops_aten__flash_attention_forward_xpu_float16
op_ut,third_party.torch-xpu-ops.test.xpu.test_meta_xpu.TestMetaXPU,test_dispatch_meta_outplace_torch_ops_aten__flash_attention_forward_xpu_float16
## Root Cause
The `aten::_flash_attention_forward` operator is not registered for the XPU device. When the meta dispatch tests try to execute this op on an XPU tensor, it fails with a "not implemented" error, which gets wrapped as `Exception: Original OpInfo is broken`.
The underlying error is:
```
The operator 'aten::_flash_attention_forward' is not currently implemented for the XPU device.
```
This is separate from the flex_attention export tests (Group 1), which fail due to graph structure mismatch. Here, the op itself cannot run on XPU.
**Fix:** Either:
1. Implement `_flash_attention_forward` for XPU (substantial effort).
2. Add these test patterns to the skip list in `skip_list_common.py` (the `_flash_attention_` pattern already skips flash attention in `test_ops_xpu.py` but not in `test_meta_xpu.py`).
## Reproducer
```bash
source ~/.bashrc && cd third_party/torch-xpu-ops/test/xpu && python -m pytest -sxv test_meta_xpu.py -k "test_dispatch_symbolic_meta_outplace_torch_ops_aten__flash_attention_forward_xpu_float16"
```
```bash
source ~/.bashrc && cd third_party/torch-xpu-ops/test/xpu && python -m pytest -sxv test_meta_xpu.py -k "test_dispatch_meta_outplace_torch_ops_aten__flash_attention_forward_xpu_float16"
```
## Representative Error
```
Exception: Original OpInfo is broken
Caused by sample input at index 0: SampleInput(input=Tensor[size=(4, 11, 4, 8),
device="xpu:0", dtype=torch.float16, contiguous=False], ...)
The operator 'aten::_flash_attention_forward' is not currently implemented for
the XPU device. Please open a feature on https://github.com/intel/torch-xpu-ops/issues.
You can set the environment variable `PYTORCH_ENABLE_XPU_FALLBACK=1` to use the
CPU implementation as a fallback for XPU unimplemented operators.
```
Contributor guide
Assessment
This issue has not been assessed yet.