compute-runtime icon indicating copy to clipboard operation
compute-runtime copied to clipboard

Way to query free memory from an openCL backend on discrete Intel GPUs

Open icfaust opened this issue 11 months ago • 3 comments

As a developer for the uxlfoundation on the oneDAL and scikit-learn-intelex, I would like to query the free memory of an Intel GPU when a level zero driver is unavailable, but an openCL is. This would be especially important for automated testing using Intel Data Center GPU products (Intel Max 1550) when accessing the underlying shared object memory allocations are not possible simply and/or directly.

While the functionality is available in SYCL when the level Zero SysMan is available, there is no equivalent for openCL backends on intel discrete products. However, for other vendors such functionality exists: nvmlDeviceGetMemoryInfo for NVidia and CL_DEVICE_GLOBAL_FREE_MEMORY_AMD for Radeon products.

Replicated from this reddit post (could not find the related issues in the compute-runtime closed/open list): https://www.reddit.com/r/OpenCL/comments/uocbbq/comment/i8rcfhs/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

icfaust avatar Feb 09 '25 12:02 icfaust

@icfaust see https://github.com/intel/compute-runtime/issues/586.

eero-t avatar Feb 12 '25 15:02 eero-t

@eero-t Thank you for the link, I do appreciate your suggestion here to use ze_sysman for querying the free memory. We use that successfully already on level-zero enabled discrete intel GPUs, however, in some cases we are trying to verify operation on openCL backends, while it is discussed how to query the total available memory on a device via openCL, it does not return the current free memory on a device.

icfaust avatar Feb 13 '25 10:02 icfaust

I was thinking of CL_DEVICE_MAX_MEM_ALLOC_SIZE adapting to available memory, but looking closer at spec: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#CL_DEVICE_MAX_MEM_ALLOC_SIZE

Its minimum value seems to be 1GB.

eero-t avatar Feb 13 '25 13:02 eero-t