[SYCL] Enhance to get the free memory of Intel GPU - #27968
Conversation
|
Can confirm, this PR does remove the errors in llama.cpp being unable to query A770 free memory regions, even when using the Xe driver. |
|
Hey arthw, thanks for putting the PR together. I'm the one who posted the 4B test data and devcoredumps on #27595. I want to validate this on a B70, since that card isn't in your test matrix. Same one from the original report: Battlemage G31, 32GB, 8086:E223, kernel 7.0.0-30, driver 26.27.39122.14 from the Intel PPA. What's the cleanest way to exercise the change? Build this branch and compare the memory breakdown with --fit between GGML_SYCL_GET_MEM_API settings? Or is there a specific command you'd rather I run? Happy to post before and after numbers here. I've also got a B60 going into a second box, so I can cover that card too once it's up. |
|
Validated this on an Arc Pro B70 (32GB Battlemage) with a 27B model holding about 23.4GB VRAM. All three paths plan the same context:
So both query paths are accurate on B70 with the current driver, and the change is a no-op here. That fills in a Battlemage datapoint for the matrix. Separate observation, and I do not think it is caused by this PR: under sustained load (4 parallel streams of small prompts, 200 tokens each) both builds eventually hit a xe driver job timeout and engine reset, then llama-server dies with UR_RESULT_ERROR_DEVICE_LOST on FLASH_ATTN_EXT at ggml-sycl.cpp:5428. The crash reproduces identically on master and on this build, so it looks like a driver/SYCL issue independent of the memory query change. Happy to share dmesg and coredump details if that is useful for a separate issue. |
|
@HumerousGorgon @NateHag When I check the issue: #27595, it hint me that the method to get the free mem size would impact it. @NateHag Thank you! |
* enhance get mem info by l0 an SYCL API * remove debug code, format the code * update SYCL.md for GGML_SYCL_GET_MEM_API
Overview
The legacy code use SYCL API to get the free mem size.
It can support all GPUs to get free size. In such case, use the total to replace it.
This PR support both level zero and SYCL API to get the free memory.
level zero API can support more GPUs and cases.
It can be changed by env var: GGML_SYCL_GET_MEM_API
Additional information
SYCL API get free mem has limitation:
There is risk to get the wrong free memory during running, it will bring some troubles.
Some issues would have relationship with it, like memory leak.
In this PR, use both level zero and SYCL API to get the free mem size.
It's controlled by env var: GGML_SYCL_GET_MEM_API.
It's verified on Arc770, B60, iGPU(UHD Graphics 770, Ultra 7 265K).
No performance impact.
Base:
PR:
Requirements