openvinotoolkit / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
250 stars 39 forks source link

[Bug]: How to check if iGPU is being used #27

Open lamw opened 10 months ago

lamw commented 10 months ago

Is there an existing issue for this?

What happened?

I've got Intel NUC 13 Pro which has the following iGPU

$ sudo xpu-smi discovery -d 0
+-----------+--------------------------------------------------------------------------------------+
| Device ID | Device Information                                                                   |
+-----------+--------------------------------------------------------------------------------------+
| 0         | Device Type: GPU                                                                     |
|           | Device Name: Intel Corporation Device a7a0 (rev 04)                                  |
|           | PCI Device ID: 0xa7a0                                                                |
|           | Vendor Name: Intel(R) Corporation                                                    |
|           | UUID: 00000000-0000-0502-0000-0004a7a08086                                           |
|           | Serial Number: unknown                                                               |
|           | Core Clock Rate: 1500 MHz                                                            |
|           | Stepping: B0                                                                         |
|           | SKU Type:                                                                            |
|           |                                                                                      |
|           | Driver Version: 1.23.6.24.230425.29+i44-1                                            |
|           | Kernel Version: 6.2.0-31-generic                                                     |
|           | GFX Firmware Name: GFX                                                               |
|           | GFX Firmware Version:                                                                |
|           | GFX Firmware Status: unknown                                                         |
|           |                                                                                      |
|           | PCI BDF Address: 0000:02:05.0                                                        |
|           | PCI Slot:                                                                            |
|           | PCIe Generation: 2                                                                   |
|           | PCIe Max Link Width: 32                                                              |
|           | OAM Socket ID:                                                                       |
|           |                                                                                      |
|           | Memory Physical Size: 0.00 MiB                                                       |
|           | Max Mem Alloc Size: 4095.99 MiB                                                      |
|           | ECC State:                                                                           |
|           | Number of Memory Channels:                                                           |
|           | Memory Bus Width:                                                                    |
|           | Max Hardware Contexts: 65536                                                         |
|           | Max Command Queue Priority: 0                                                        |
|           |                                                                                      |
|           | Number of EUs: 96                                                                    |
|           | Number of Tiles: 1                                                                   |
|           | Number of Slices: 1                                                                  |
|           | Number of Sub Slices per Slice: 6                                                    |
|           | Number of Threads per EU: 7                                                          |
|           | Physical EU SIMD Width: 8                                                            |
|           | Number of Media Engines: 0                                                           |
|           | Number of Media Enhancement Engines: 0                                               |
|           |                                                                                      |
|           | Number of Xe Link ports:                                                             |
|           | Max Tx/Rx Speed per Xe Link port:                                                    |
|           | Number of Lanes per Xe Link port:                                                    |
+-----------+--------------------------------------------------------------------------------------+

When running the webUI, I only see CPU spike but not iGPU, which I'm using xpu-smi to retrieve stats

xpu-smi stats -d 0

Steps to reproduce the problem

Step 1 - Run webUI with the following:

export PYTORCH_TRACING_MODE=TORCHFX
export COMMANDLINE_ARGS="--skip-torch-cuda-test --precision full --no-half --share --listen"
./webui.sh

Step 2 - Follow webUI tweaks from to ensure OpenVINO is used for acceleration which says both CPU/GPU is supported (selecting GPU setting of course)

Step 3 - The processing seems just as slow as selecting CPU

What should have happened?

Performance should have improved when using GPU option

Version or Commit where the problem happens

latest

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Linux

What device are you running WebUI on?

Other GPUs

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

export PYTORCH_TRACING_MODE=TORCHFX
export COMMANDLINE_ARGS="--skip-torch-cuda-test --precision full --no-half --share --listen"

List of extensions

No

Console logs

./webui.sh

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on vmware user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Cannot locate TCMalloc (improves CPU memory usage)
fatal: No names found, cannot describe anything.
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Version: 1.5.1
Commit hash: 434282272d43591e17f157954efe5869c7004c05
Launching Web UI with arguments: --skip-torch-cuda-test --precision full --no-half --share --listen
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx', memory monitor disabled
Loading weights [6ce0161689] from /home/vmware/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Running on local URL:  http://0.0.0.0:7860
Creating model from config: /home/vmware/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Running on public URL: https://ac1e5246ec98e6d115.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)
Startup time: 10.9s (launcher: 0.3s, import torch: 3.5s, import gradio: 0.7s, setup paths: 0.6s, other imports: 0.8s, load scripts: 1.7s, create ui: 0.8s, gradio launch: 2.4s).
Applying attention optimization: InvokeAI... done.
Model loaded in 18.2s (load weights from disk: 1.2s, create model: 0.3s, apply weights to model: 16.4s, calculate empty prompt: 0.2s).
Loading weights [6ce0161689] from /home/vmware/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
OpenVINO Script:  created model from config : /home/vmware/stable-diffusion-webui/configs/v1-inference.yaml
You have disabled the safety checker for <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> by passing `safety_checker=None`. Ensure that you abide to the conditions of the Stable Diffusion license and do not expose unfiltered results in services or applications open to the public. Both the diffusers team and Hugging Face strongly recommend to keep the safety filter enabled in all public facing circumstances, disabling it only for use-cases that involve analyzing network behavior or auditing its results. For more information, please have a look at https://github.com/huggingface/diffusers/pull/254 .
  0%|                                                                                                                                                                         | 0/20 [00:00<?, ?it/s]


### Additional information

_No response_
J4ckTh3R1pper commented 9 months ago

same issue on Gentoo Linux, Intel Core i7-1165G7 with Iris Xe Graphics (96EU), only CPU is used even if I tuned the script to use GPU instead.

dfmjndm commented 6 months ago

Same issue in UHD graphic card. Only CPU works

kwaitsing commented 5 months ago

I use intel_gpu_top, and found out that the load is low, so i don't think it's using iGPU for computing. But the weird thing is that when OpenVINO script is enabled, it's slower...

midnitedestiny commented 4 months ago

What platforms do you use to access the UI

I used the script and clicked GPU but my task manager shows 70% of it being done via CPU which is odd since I dont have a IGPU only a GPU which is my Intel arc 770. so why would it still use my CPU even after following all the steps to install?