Closed jjfumero closed 2 years ago
I think maxMemAllocSize
in ze_device_properties_t
is what you are looking for.
There is also an extension that will let you allocate beyond that limit. See ze_relaxed_allocation_limits_exp_desc_t
Thank you @bmyates. That's exactly what I was looking for.
Interesting. This seems to work. I am able to allocate 8GB.
./levelZeroAlloc 8147483648
Device : Intel(R) UHD Graphics [0x9bc4]
Type : GPU
Vendor ID: 8086
Allocating Shared: 8147483648 bytes - 8.14748 (GB) ----- [OK]
Just for reference, this works (e.g,, a shared memory buffer):
ze_device_mem_alloc_desc_t memAllocDesc = {ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC};
memAllocDesc.flags = ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_CACHED;
memAllocDesc.ordinal = 0;
ze_host_mem_alloc_desc_t hostDesc = {ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC};
ze_relaxed_allocation_limits_exp_desc_t exceedCapacity = {
ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC,
nullptr,
ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE
};
void *sharedBuffer = nullptr;
hostDesc.pNext = &exceedCapacity;
memAllocDesc.pNext = &exceedCapacity;
result = zeMemAllocShared(context, &memAllocDesc, &hostDesc, allocSize, 128, device, &sharedBuffer);
A follow-up question is from the comment in the SPEC:
Allocation size may exceed ze_device_properties_t.maxMemAllocSize.
https://github.com/oneapi-src/level-zero/blob/master/include/ze_api.h#L6312
Does this mean that the requested extended size is not guaranteed?
@jjfumero this is a question on spec. Please move it to https://github.com/oneapi-src/level-zero-spec/issues
I am allocating some large buffers with
zeMemAllocShared
,zeMemAllocDevice
andzeMemAllocHost
functions from Level Zero. I am able to allocate ~4.9GB on my system, despite the fact that, with my configuration, OpenCL max allocation is set to 4 GiB for the same Intel HD graphics.Is there any way in Level Zero to obtain the max allocation size for a single buffer? I was looking at this struct, but I can't find such information: https://spec.oneapi.io/level-zero/latest/core/api.html?highlight=device_memory_properties#_CPPv429ze_device_memory_properties_t
Also, is there any way to allocate more than 5GB for a single buffer?