intel / compute-runtime

Intel® Graphics Compute Runtime for oneAPI Level Zero and OpenCL™ Driver
MIT License
1.13k stars 232 forks source link

Error when zesInit() on windows client #712

Closed sgwhat closed 6 months ago

sgwhat commented 6 months ago

Hi all,

I am trying to loading "ze_intel_gpu64.dll" on my windows client, but it doesn't work. I tried to loaded libze_intel_gpu.so on ubuntu before, and it works well. Could you please give me some advice to debug?

Thanks!

sgwhat commented 6 months ago

Here is my implementation, error happens when executed ret = (*resp->oh.zesInit)(0); and ze_intel_gpu64.dll could be loaded by LoadLibrary.

https://github.com/felipeagc/ollama/blob/main/gpu/gpu_info_oneapi.c https://github.com/felipeagc/ollama/blob/main/gpu/gpu_info_oneapi.h

sgwhat commented 6 months ago

I also tried "C:\Windows\System32\ze_loader.dll", but still got error:

image

JablonskiMateusz commented 6 months ago

Hi @sgwhat
do you see issue only with zesInit? Does zeInit work fine?

sgwhat commented 6 months ago

Hi @sgwhat do you see issue only with zesInit? Does zeInit work fine?

No, it's failed. It's wired that I can't load ze-loader.dll or ze-intel-gpu64.dll.

JablonskiMateusz commented 6 months ago

is it problem with loading dll library or calling zeInit, or even loading anything in between?

sgwhat commented 6 months ago

is it problem with loading dll library or calling zeInit, or even loading anything in between?

Just with calling zeInit after I loading ze_loader.dll by LoadLibrary. https://github.com/felipeagc/ollama/blob/0c5346e55731d8d9466d18766cb98169edbecab5/gpu/gpu_info_oneapi.c#L61

JablonskiMateusz commented 6 months ago

you may build ze_loader.dll by yourself and see where it fails on loader side https://github.com/oneapi-src/level-zero

eero-t commented 6 months ago

is it problem with loading dll library or calling zeInit, or even loading anything in between?

Just with calling zeInit after I loading ze_loader.dll by LoadLibrary. https://github.com/felipeagc/ollama/blob/0c5346e55731d8d9466d18766cb98169edbecab5/gpu/gpu_info_oneapi.c#L61

Error in your backtrace is calling of a NULL pointer (PC=0). Are you sure your log level is such that LOG() would show resolving errors, and thatLOAD_LIBRARY() e.g. calls library initializers?

(AFAIK on Linux dynamic loader does that automatically, but I do not know about Windows mechanisms.)

PS. As general comments on gpu_info_oneapi.c, you could consider including Level-Zero loader zes_api.h header instead of copying subset of its values to gpu_info_oneapi.h. (Maybe also consider using sizeof() for buffer sizes instead of separate buflen variable)

sgwhat commented 6 months ago

Hi, I have fixed this issue, thank you for your help! @eero-t @JablonskiMateusz