Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using xpu backend, stable diffusion give bad result (comparing with 'cpu' backend and also opevino) #713

Open
LeptonWu opened this issue Sep 22, 2024 · 1 comment
Assignees
Labels
ARC ARC GPU Correctness Output incorrect or unacceptable accuracy loss LLM

Comments

@LeptonWu
Copy link

Describe the bug

Hi, I noticed that when I am using intel-extension-for-pytorch, it seems stable diffusion just doesn't care about my full prompt and the generated picuture is quiet bad quality. I have a minimal case to show this. Here is the code to generate a picture , if I change to use cpu backend, I got a much better output. Also the output is consistent with the output if I am using openvino with their GPU backend.

#!/home/leptonwu/venv_ipex/bin/python
import time
import torch
import intel_extension_for_pytorch
from diffusers import StableDiffusionPipeline

torch.manual_seed(0)
device = "xpu"
pipe = StableDiffusionPipeline.from_single_file("realisticVisionV60B1_v51HyperVAE.safetensors").to(device)
start = time.time()
image = pipe("a man eating apple", guidance_scale=1.5,
                width=512, height=512, num_inference_steps=6)
image.images[0].save("out-ipex-%s.jpg" % device)
print(time.time() - start)

out-ipex-xpu
out-ipex-cpu

Versions

Collecting environment information...
PyTorch version: 2.3.1+cxx11.abi
PyTorch CXX11 ABI: Yes
IPEX version: 2.3.110+xpu
IPEX commit: 95c9459
Build type: Release

OS: Debian GNU/Linux 12 (bookworm) (x86_64)
GCC version: (Debian 12.2.0-14) 12.2.0
Clang version: N/A
IGC version: N/A
CMake version: version 3.25.1
Libc version: glibc-2.36

Python version: 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] (64-bit runtime)
Python platform: Linux-6.10.6+bpo-amd64-x86_64-with-glibc2.36
Is XPU available: True
DPCPP runtime version: N/A
MKL version: N/A
GPU models and configuration:
[0] _XpuDeviceProperties(name='Intel(R) Arc(TM) A580 Graphics', platform_name='Intel(R) Level-Zero', type='gpu', driver_version='1.3.29735', total_memory=7721MB, max_compute_units=384, gpu_eu_count=384, gpu_subslice_count=24, max_work_group_size=1024, max_num_sub_groups=128, sub_group_sizes=[8 16 32], has_fp16=1, has_fp64=0, has_atomic64=1)
Intel OpenCL ICD version: 24.22.29735.27-91422.04
Level Zero version: 1.3.29735.27-914
22.04

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 43 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 7 3700X 8-Core Processor
CPU family: 23
Model: 113
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
Stepping: 0
Frequency boost: enabled
CPU(s) scaling MHz: 86%
CPU max MHz: 4426.1709
CPU min MHz: 2200.0000
BogoMIPS: 7199.56
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl rdpid overflow_recov succor smca sev sev_es
Virtualization: AMD-V
L1d cache: 256 KiB (8 instances)
L1i cache: 256 KiB (8 instances)
L2 cache: 4 MiB (8 instances)
L3 cache: 32 MiB (2 instances)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow: Mitigation; Safe RET
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; Retpolines; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[pip3] dctorch==0.1.2
[pip3] intel_extension_for_pytorch==2.3.110+xpu
[pip3] numpy==1.26.4
[pip3] open_clip_torch==2.26.1
[pip3] pytorch-lightning==1.9.4
[pip3] torch==2.3.1+cxx11.abi
[pip3] torchdiffeq==0.2.4
[pip3] torchmetrics==1.4.2
[pip3] torchsde==0.2.6
[pip3] torchvision==0.18.1+cxx11.abi
[conda] N/A

@alexsin368
Copy link

alexsin368 commented Sep 24, 2024

@LeptonWu this issue could be related to #529 and my team members are looking into it.

@ZhaoqiongZ ZhaoqiongZ self-assigned this Sep 24, 2024
@alexsin368 alexsin368 assigned alexsin368 and unassigned ZhaoqiongZ Sep 24, 2024
@jingxu10 jingxu10 added ARC ARC GPU Correctness Output incorrect or unacceptable accuracy loss LLM labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARC ARC GPU Correctness Output incorrect or unacceptable accuracy loss LLM
Projects
None yet
Development

No branches or pull requests

4 participants