intel-extension-for-pytorch icon indicating copy to clipboard operation
intel-extension-for-pytorch copied to clipboard

`index_select` fails on XPU when big indices are provided

Open DamianSzwichtenberg opened this issue 2 years ago • 5 comments

Describe the bug

In GNNs, index_select is quite a common operation, I noticed that when I'm using a very big batch size, this operation fails with the following error:

RuntimeError: Provided range is out of integer limits. Pass `-fno-sycl-id-queries-fit-in-int' to disable range check. -30 (PI_ERROR_INVALID_VALUE)

This error occurs only when XPU is a target device. Below is a minimal code to reproduce this:

import torch
import intel_extension_for_pytorch  # 2.0.1


src = torch.rand((256000, 128))
index = torch.randint(0, src.size(0), (32000000, ))
# works well on CPU
src.index_select(0, index)

src = src.to('xpu')
index = index.to('xpu')
# fails on GPU with the following error:
# RuntimeError: Provided range is out of integer limits. Pass `-fno-sycl-id-queries-fit-in-int' to disable range check. -30 (PI_ERROR_INVALID_VALUE)
src.index_select(0, index)

Versions

PyTorch version: 2.0.1a0+gite9ebda2
PyTorch CXX11 ABI: Yes
IPEX version: 2.0.110+git509a378
IPEX commit: 509a3789d
Build type: Release

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: N/A
IGC version: 2023.1.0 (2023.1.0.20230320)
CMake version: version 3.27.1
Libc version: glibc-2.35

Python version: 3.10.12 (main, Jul  5 2023, 18:54:27) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.19.0-41-generic-x86_64-with-glibc2.35
Is XPU available: True
DPCPP runtime version: 2023.1.0
MKL version: 2023.1.0
GPU models and configuration:
[0] _DeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) Level-Zero', dev_type='gpu, support_fp64=1, total_memory=62244MB, max_compute_units=448, gpu_eu_count=448)
[1] _DeviceProperties(name='Intel(R) Data Center GPU Max 1550', platform_name='Intel(R) Level-Zero', dev_type='gpu, support_fp64=1, total_memory=62244MB, max_compute_units=448, gpu_eu_count=448)
Intel OpenCL ICD version: 23.17.26241.21-647~22.04
Level Zero version: 1.3.26241.21-647~22.04

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Address sizes:                   46 bits physical, 57 bits virtual
Byte Order:                      Little Endian
CPU(s):                          64
On-line CPU(s) list:             0-63
Vendor ID:                       GenuineIntel
Model name:                      Intel(R) Xeon(R) Platinum 8352Y CPU @ 2.20GHz
CPU family:                      6
Model:                           106
Thread(s) per core:              2
Core(s) per socket:              32
Socket(s):                       1
Stepping:                        6
CPU max MHz:                     3400.0000
CPU min MHz:                     800.0000
BogoMIPS:                        4400.00
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid fsrm md_clear pconfig flush_l1d arch_capabilities
Virtualization:                  VT-x
L1d cache:                       1.5 MiB (32 instances)
L1i cache:                       1 MiB (32 instances)
L2 cache:                        40 MiB (32 instances)
L3 cache:                        48 MiB (1 instance)
NUMA node(s):                    1
NUMA node0 CPU(s):               0-63
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

Versions of relevant libraries:
[pip3] intel-extension-for-pytorch==2.0.110+git509a378
[pip3] numpy==1.25.2
[pip3] torch==2.0.1a0+gite9ebda2
[pip3] torch_geometric==2.4.0
[pip3] torch-geometric-benchmark==0.1.0
[pip3] torch-scatter==2.1.1
[pip3] torch-sparse==0.6.17
[conda] intel-extension-for-pytorch 2.0.110+git509a378          pypi_0    pypi
[conda] numpy                     1.25.2                   pypi_0    pypi
[conda] torch                     2.0.1a0+gite9ebda2          pypi_0    pypi
[conda] torch-geometric           2.4.0                    pypi_0    pypi
[conda] torch-geometric-benchmark 0.1.0                     dev_0    <develop>
[conda] torch-scatter             2.1.1                     dev_0    <develop>
[conda] torch-sparse              0.6.17                    dev_0    <develop>

DamianSzwichtenberg avatar Nov 13 '23 08:11 DamianSzwichtenberg

@DamianSzwichtenberg thanks for reporting, we will try to reproduce.

tye1 avatar Nov 14 '23 08:11 tye1

@tye1 - any update on this?

MarekStrachacki avatar Nov 30 '23 07:11 MarekStrachacki

We are able to reproduce the issue. Will investigate the root cause.

tye1 avatar Jan 16 '24 10:01 tye1

@tye1 - did you find the root cause?

MarekStrachacki avatar Feb 08 '24 10:02 MarekStrachacki

@MarekStrachacki Sorry for the late response. We have root caused it and will provide a fix soon. Once ready, will update here.

tye1 avatar Apr 15 '24 08:04 tye1