intel / intel-extension-for-pytorch

A Python package for extending the official PyTorch that can easily obtain performance on Intel platform
Apache License 2.0
1.53k stars 236 forks source link

Interpolation with default params on XPU differs from CPU execution #351

Closed donggangj closed 7 months ago

donggangj commented 1 year ago

Describe the bug

import torch
import intel_extension_for_pytorch as ipex

x = torch.rand(1, 3, 180, 320)
new_shape = (360, 480)
dummy_img = (x - x.min()) / (x.max() - x.min()) * 255.
y_cpu = torch.functional.F.interpolate(dummy_img, new_shape)
y_xpu = torch.functional.F.interpolate(dummy_img.xpu(), new_shape)
mae = abs(y_cpu - y_xpu.cpu()).mean()
print(mae)
image

Versions

Collecting environment information... PyTorch version: 1.13.0a0+git6c9b55e PyTorch CXX11 ABI: Yes IPEX version: 1.13.120+xpu IPEX commit: c2a37012e Build type: Release

OS: Ubuntu 20.04.5 LTS (x86_64) GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 Clang version: N/A IGC version: 2023.1.0 (2023.1.0.20230320) CMake version: version 3.23.2 Libc version: glibc-2.31

Python version: 3.9.16 (main, Mar 8 2023, 14:00:05) [GCC 11.2.0] (64-bit runtime) Python platform: Linux-5.14.0-1047-oem-x86_64-with-glibc2.31 Is XPU available: True DPCPP runtime version: 2023.1.0 MKL version: 2023.1.0 GPU models and configuration: [0] _DeviceProperties(name='Intel(R) Graphics [0x5690]', platform_name='Intel(R) Level-Zero', dev_type='gpu, support_fp64=0, total_memory=15473MB, max_compute_units=512) [1] _DeviceProperties(name='Intel(R) Graphics [0x4626]', platform_name='Intel(R) Level-Zero', dev_type='gpu, support_fp64=0, total_memory=25348MB, max_compute_units=96) Intel OpenCL ICD version: 22.35.24055 Level Zero version: 1.3.24055

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 20 On-line CPU(s) list: 0-19 Thread(s) per core: 1 Core(s) per socket: 14 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 154 Model name: 12th Gen Intel(R) Core(TM) i7-12700H Stepping: 3 CPU MHz: 2700.000 CPU max MHz: 4700.0000 CPU min MHz: 400.0000 BogoMIPS: 5376.00 Virtualization: VT-x L1d cache: 336 KiB L1i cache: 224 KiB L2 cache: 8.8 MiB NUMA node0 CPU(s): 0-19 Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected 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 tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr flush_l1d arch_capabilities

Versions of relevant libraries: [pip3] intel-extension-for-pytorch==1.13.120+xpu [pip3] numpy==1.24.3 [pip3] pytorch-lightning==1.3.5 [pip3] torch==1.13.0a0+git6c9b55e [pip3] torchmetrics==0.5.1 [pip3] torchvision==0.14.1a0+5e8e2f1 [conda] intel-extension-for-pytorch 1.13.120+xpu pypi_0 pypi [conda] numpy 1.24.3 pypi_0 pypi [conda] pytorch-lightning 1.3.5 pypi_0 pypi [conda] torch 1.13.0a0+git6c9b55e pypi_0 pypi [conda] torchmetrics 0.5.1 pypi_0 pypi [conda] torchvision 0.14.1a0+5e8e2f1 pypi_0 pypi

gujinghui commented 1 year ago

@tye1 pls submit a JIRA to track this issue.

tye1 commented 1 year ago

@donggangj could you please verify if this commit https://github.com/intel/intel-extension-for-pytorch/commit/5ca52bd2e3fe625f6bde388b877eb180e8df063d can resolve your issue or not?

tye1 commented 7 months ago

@donggangj let me close this now. Feel free to reopen if you still meet this issue in IPEX master.