bes-dev / stable_diffusion.openvino

Apache License 2.0
1.54k stars 205 forks source link

"Could not find entry point" when trying to use GPU #122

Open BluishHumility opened 1 year ago

BluishHumility commented 1 year ago

Hello,

I am interested in using my ARC A750 GPU, but I am running into an error:

python demo.py --prompt "Street-art painting of Emilia Clarke in style of Banksy, photorealism"
Traceback (most recent call last):
  File "/home/jeremy/stable_diffusion.openvino/demo.py", line 79, in <module>
    main(args)
  File "/home/jeremy/stable_diffusion.openvino/demo.py", line 34, in main
    engine = StableDiffusionEngine(
  File "/home/jeremy/stable_diffusion.openvino/stable_diffusion_engine.py", line 41, in __init__
    self.unet = self.core.compile_model(self._unet, device)
  File "/home/jeremy/.local/lib/python3.10/site-packages/openvino/runtime/ie_api.py", line 399, in compile_model
    super().compile_model(model, device_name, {} if config is None else config),
RuntimeError: cldnn program build failed! Could not find entry point

A comment here implies the only change that needs to be made is to change "CPU" to "GPU" in stable_diffusion_engine.py (which is backed up by a commend in this issue here), but it seems like there is perhaps something more to it.

If I leave device="CPU" it runs fine (obviously using the CPU instead of the GPU).

Note: I removed the version numbers from numpy and opencv-python in requirements.txt due to an error I was getting during installation. I am not sure if that is relevant or not but I figured I'd mention it just in case.

brmarkus commented 1 year ago

Do you have an "OpenVINO environment" set-up on your machine? Then you might call it's sample called hello_query_device, which prints out all de3vices/accelerators which could be found, it's corresponding plugin-loaded and initialized.

If you have an integrated/embedded GPU inside your SoC (like some of the Intel SoC have a CPU and an integrated/embedded GPU), then that device would be GPU instead of using CPU; but if you have a discrete GPU (or multiple dGPUs), then the device-name might be different, e.g. GPU.1.

However, for being able to use (Intel-supported) GPUs certain drivers need to be installed first, like OpenCL drivers; depending on which HW you might need to install a specific version or a version not older than a specific version-number.

raymondlo84 commented 1 year ago

https://github.com/openvinotoolkit/openvino_notebooks/discussions/540 This may help.

BluishHumility commented 1 year ago

Apologies for the lengthy delay in response; I did not get a notification for activity in the thread for some reason and I did not realize anyone had replied!

Do you have an "OpenVINO environment" set-up on your machine? Then you might call it's sample called hello_query_device, which prints out all de3vices/accelerators which could be found, it's corresponding plugin-loaded and initialized.

This is a good clue. I looked up this tool you mentioned and found a page here, but couldn't quite figure out how to use it or install it (or if it is installed already; I could not find a hello_query_device file on my system anywhere). I haven't learned how to interact with Python in any way, so I'm a bit over my head.

I tried to figure out if I have an OpenVINO environment like you mentioned, but again I'm kind of stumped. I followed whatever set up is described in the wiki:

python -m pip install --upgrade pip
pip install openvino-dev[onnx,pytorch]==2022.3.0
pip install -r requirements.txt

This has given me stable_diffusion.openvino directory/repo, where stable_diffusion_engine.py and associated files are located, as well as a directory at .local/lib/python3.10 with a lot of Python/OpenVINO stuff in it. I can't seem to find how to determine what Python environments I have, however, or how to access them.

All that to say, I can't get the python hello_query_device.py command to work, but it is not clear to me if that is because I don't have it installed or I am just doing it wrong, or both.

If you have an integrated/embedded GPU inside your SoC (like some of the Intel SoC have a CPU and an integrated/embedded GPU), then that device would be GPU instead of using CPU; but if you have a discrete GPU (or multiple dGPUs), then the device-name might be different, e.g. GPU.1.

I do have an integrated GPU in addition to the ARC GPU, so I suppose I'm that much further from figuring out what the heck I am doing. I was not able to get the hello_query_device output just yet to help identify the devices, but I did just blindly change the device= value to GPU.1 (as well as a few other values which immediately failed) just to test, and did get a different result.

python demo.py --prompt "Street-art painting of Emilia Clarke in style of Banksy, photorealism"
/usr/include/c++/12.2.0/bits/stl_vector.h:1142: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = NEO::ArgTypeMetadataExtended; _Alloc = std::allocator<NEO::ArgTypeMetadataExtended>; const_reference = const NEO::ArgTypeMetadataExtended&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
fish: Job 1, 'python demo.py --prompt "Street…' terminated by signal SIGABRT (Abort)

It core dumps instead of the RuntimeError: cldnn program build failed! Could not find entry point error message--obviously still not working, but it does seem to imply that I have referenced a device that it is interacting with in some way.

However, for being able to use (Intel-supported) GPUs certain drivers need to be installed first, like OpenCL drivers; depending on which HW you might need to install a specific version or a version not older than a specific version-number.

I do have intel-opencl-clang 15.0.0-1 installed, which is the only intel-opencl package I can find that has been recently updated (last modified 2023-1-07).

This may help.

Thank you, that looks like a helpful guide but I do not have an Ubuntu installation to take advantage of those special repos and packages. I also do not have a 12th gen CPU, and lastly I want to use the dGPU, not the integrated GPU. I do appreciate the effort though, that looks like you will save some folks a considerable amount of time.