intel / intel/torch-xpu-ops

index_select / advanced indexing / nn.Embedding hang indefinitely on Intel UHD Graphics (Raptor Lake iGPU), XPU backend

Open
#3,884 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 9h
Merged PRs (30d)
112

Description

### 🐛 Describe the bug

On an Intel **UHD Graphics** integrated GPU (Raptor Lake-P), integer-tensor indexing operations **hang indefinitely** on the XPU device — no error, no progress, the call never returns (only killable via SIGKILL). The identical operations are instant on CPU and CUDA.

**Hangs:** `tensor[index_tensor]` (advanced indexing), `torch.index_select`, `nn.Embedding`, and `matmul` whose operand is a `one_hot(...).float()` tensor.

**Works (for contrast):** scalar/slice indexing (`A[3]`), `torch.gather`, conv1d/conv2d, matmul of normal tensors, LSTM, `argmax`, `one_hot`.

| Operation | XPU result |
|-----------|-----------|
| `A[3]` (scalar/slice) | ✅ OK |
| `torch.gather(A, dim, idx)` | ✅ OK |
| conv / matmul(normal) / LSTM / argmax / one_hot | ✅ OK |
| `A[idx_tensor]` (advanced indexing) | ❌ HANG |
| `torch.index_select(A, 0, idx)` | ❌ HANG |
| `nn.Embedding(...)(idx)` | ❌ HANG |
| `matmul(one_hot(...).float(), B)` | ❌ HANG |

### Minimal reproducer

```python
import torch
dev = torch.device("xpu")
A = torch.randn(7, 3, device=dev)
idx = torch.tensor([3, 1, 4, 1], device=dev)
y = A[idx] # hangs forever on Intel UHD Graphics XPU
torch.xpu.synchronize()
print(y.shape) # never reached
```

`torch.gather`, `A[3]`, conv, matmul, and LSTM all complete instantly on the same device; only integer-tensor indexing / `index_select` / `nn.Embedding` hang.

### Impact

Any model using embedding lookups (all transformer/LLM token embeddings) or advanced indexing hangs on this iGPU under the XPU backend. It surfaced for me in pyannote.audio speaker diarization: the Powerset→multilabel conversion (`one_hot(argmax) @ mapping`, equivalently `mapping[argmax]`) hangs, deadlocking the segmentation step on XPU while a pure-conv embedding model runs fine.

### Workaround

Run the affected op on CPU (`x.cpu()` around the indexing), or restructure to use `torch.gather` (which works) instead of `index_select` / advanced indexing.

### Versions

- GPU: Intel Core i7-1355U integrated **Raptor Lake-P "UHD Graphics"** (PCI `8086:a721`)
- torch: `2.6.0+xpu`
- OS: Fedora 42; Level Zero `oneapi-level-zero` 1.24.2, `intel-compute-runtime` 25.31
- `torch.xpu.is_available()` → True; basic compute (matmul/conv/LSTM) works.

### Related

- intel/intel-extension-for-pytorch#802 — same UHD Graphics class, "Native API failed … during tensor indexing operations", XPU-only, unresolved (repo archived).
- intel/intel-extension-for-pytorch#513 — `xpu.synchronize` hangs (related synchronization class).

Contributor guide

Open the contributing guide

Research direction

Start by running the minimal reproducer on the Intel UHD XPU device and compare the advanced indexing, index_select, nn.Embedding, and one_hot matmul entry points with the listed working operations. Trace the XPU paths for the hanging operations and verify that they return correctly without requiring a CPU workaround or indefinite synchronization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.