intel / intel/torch-xpu-ops

[release/2.13] [LNL] test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_* Exception: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.

Open
#4,133 0 comments 0 reactions 1 assignee Claimed by @jmamzax View on GitHub
hw: LNL os: Windows test: ut
Dominant language
Python
Stars
113
Forks
128
Avg merge
5d 9h
Merged PRs (30d)
112

Description

### 🐛 Describe the bug

142 `test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_*` cases fail on LNL (Windows). Tests passed on BMG PT2.13 and LNL PT2.12

**Affected Test Cases**

```
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_abs_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_abs_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_acos_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_acos_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_acos_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_acos_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_add_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_add_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_add_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_add_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcdiv_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcdiv_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcdiv_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcdiv_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcmul_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcmul_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcmul_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_addcmul_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_asin_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_asin_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_asin_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_asin_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_atan_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_atan_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_atan_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_atan_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_ceil_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_ceil_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_clamp_max_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_clamp_max_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_clamp_min_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_clamp_min_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cos_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cos_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cos_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cos_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cosh_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cosh_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cosh_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_cosh_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_div_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_div_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_div_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_div_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_erf_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_erf_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_erfc_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_erfc_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_exp_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_exp_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_exp_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_expm1_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_expm1_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_expm1_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_expm1_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_floor_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_floor_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_frac_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_frac_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_lerp_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_lerp_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_lerp_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_lerp_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_lgamma_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_lgamma_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log10_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log10_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log10_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log10_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log1p_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log1p_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log1p_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log1p_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log2_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log2_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log2_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log2_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_log_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_maximum_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_maximum_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_minimum_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_minimum_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_mul_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_mul_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_mul_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_mul_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_neg_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_neg_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_neg_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_neg_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_pow_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_pow_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_pow_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_pow_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_reciprocal_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_reciprocal_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_reciprocal_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_reciprocal_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_round_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_round_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_rsqrt_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_rsqrt_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_rsqrt_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_rsqrt_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sigmoid_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sigmoid_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sigmoid_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sigmoid_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sign_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sign_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sin_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sin_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sin_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sin_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sinh_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sinh_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sinh_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sinh_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sqrt_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sqrt_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sqrt_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sqrt_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sub_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sub_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sub_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_sub_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tan_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tan_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tan_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tanh_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tanh_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tanh_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_tanh_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_trunc_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_trunc_outplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_zero_inplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_zero_inplace_xpu_float64
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_exp_outplace_xpu_complex128
test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_norm_outplace_xpu_float64
```

**Error Message**

- 140 UTs:

```
Exception: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.
```

- test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_exp_outplace_xpu_complex128
```
RuntimeError: max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument.
```

- test_foreach_xpu.py::TestForeachXPU::test_autodiff__foreach_exp_outplace_xpu_complex128
```
Exception: "Trying\ to\ set\ a\ forward\ gradient\ that\ has\ a\ different\ size\ than\ that\ of\ the\ original\ Tensor,\ this\ is\ not\ supported\.\ Tensor\ is\ of\ size\ \[\]\ while\ the\ given\ forward\ gradient\ is\ of\ size\ \[1" does not match "max(): Expected reduction dim to be specified for input.numel() == 0. Specify the reduction dim with the 'dim' argument."
```

### Versions

PyTorch version: 2.13.0+xpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Pro (10.0.26100 64-bit)
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.31.6
Libc version: N/A

Python version: 3.12.13 | packaged by conda-forge | (main, Mar 5 2026, 16:36:12) [MSC v.1944 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-11-10.0.26100-SP0
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: True
XPU used to build PyTorch: 20260000
Intel GPU driver version:
* 32.0.101.8826 (20260529000000.******+***)
Intel GPU models onboard:
* Intel(R) Arc(TM) 140V GPU (16GB)
Intel GPU models detected:
* [0] _XpuDeviceProperties(name='Intel(R) Arc(TM) 140V GPU (16GB)', platform_name='Intel(R) oneAPI Unified Runtime over Level-Zero V2', type='gpu', device_id=0x64A0, uuid=8680a064-0400-0000-0002-000000000000, driver_version='1.15.37858', total_memory=16870MB, local_mem_size=128KB, last_level_cache_size=8192KB, max_compute_units=64, memory_clock_rate=0MHz, memory_bus_width=64-bit, gpu_eu_count=64, gpu_subslice_count=8, max_work_group_size=1024, max_num_sub_groups=64, sub_group_sizes=[16 32], has_fp16=1, has_fp64=1, has_atomic64=1, is_integrated_gpu=1)
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: False
Caching allocator config: N/A

CPU:
Name: Intel(R) Core(TM) Ultra 7 258V
Manufacturer: GenuineIntel
Family: 774
Architecture: 9
ProcessorType: 3
DeviceID: CPU0
CurrentClockSpeed: 2200
MaxClockSpeed: 2200
L2CacheSize: 14336
L2CacheSpeed: None
Revision: None

Versions of relevant libraries:
[pip3] dpcpp-cpp-rt==2026.0.0
[pip3] intel-cmplr-lib-rt==2026.0.0
[pip3] intel-cmplr-lib-ur==2026.0.0
[pip3] intel-cmplr-lic-rt==2026.0.0
[pip3] intel-opencl-rt==2026.0.0
[pip3] intel-openmp==2026.0.0
[pip3] intel-pti==0.17.0
[pip3] intel-sycl-rt==2026.0.0
[pip3] mkl==2026.0.0
[pip3] mkl-include==2024.2.0
[pip3] mkl-static==2024.2.0
[pip3] mypy_extensions==1.1.0
[pip3] numpy==1.26.2
[pip3] onemkl-license==2026.0.0
[pip3] onemkl-sycl-blas==2026.0.0
[pip3] onemkl-sycl-dft==2026.0.0
[pip3] onemkl-sycl-lapack==2026.0.0
[pip3] onemkl-sycl-rng==2026.0.0
[pip3] onemkl-sycl-sparse==2026.0.0
[pip3] onnx==1.21.0
[pip3] onnx-ir==0.1.16
[pip3] onnxscript==0.6.2
[pip3] optree==0.13.0
[pip3] tbb==2023.0.0
[pip3] tbb-devel==2021.13.1
[pip3] tcmlib==1.5.0
[pip3] torch==2.13.0+xpu
[pip3] torchaudio==2.11.0+xpu
[pip3] torchvision==0.28.0+xpu
[pip3] triton-xpu==3.7.2
[pip3] umf==1.1.0
[conda] dpcpp-cpp-rt 2026.0.0 pypi_0 pypi
[conda] intel-cmplr-lib-rt 2026.0.0 pypi_0 pypi
[conda] intel-cmplr-lib-ur 2026.0.0 pypi_0 pypi
[conda] intel-cmplr-lic-rt 2026.0.0 pypi_0 pypi
[conda] intel-opencl-rt 2026.0.0 pypi_0 pypi
[conda] intel-openmp 2026.0.0 pypi_0 pypi
[conda] intel-pti 0.17.0 pypi_0 pypi
[conda] intel-sycl-rt 2026.0.0 pypi_0 pypi
[conda] mkl 2026.0.0 pypi_0 pypi
[conda] mkl-include 2024.2.0 pypi_0 pypi
[conda] mkl-static 2024.2.0 pypi_0 pypi
[conda] numpy 1.26.2 pypi_0 pypi
[conda] onemkl-license 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-blas 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-dft 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-lapack 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-rng 2026.0.0 pypi_0 pypi
[conda] onemkl-sycl-sparse 2026.0.0 pypi_0 pypi
[conda] optree 0.13.0 pypi_0 pypi
[conda] tbb 2023.0.0 pypi_0 pypi
[conda] tbb-devel 2021.13.1 pypi_0 pypi
[conda] tcmlib 1.5.0 pypi_0 pypi
[conda] torch 2.13.0+xpu pypi_0 pypi
[conda] torchaudio 2.11.0+xpu pypi_0 pypi
[conda] torchvision 0.28.0+xpu pypi_0 pypi
[conda] triton-xpu 3.7.2 pypi_0 pypi
[conda] umf 1.1.0 pypi_0 pypi

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.