oneapi-src / oneapi-src/level-zero
Relaxed Allocation Limit in Level Zero
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 335
- Forks
- 140
- Avg merge
- 12h 32m
- Merged PRs (30d)
- 5
Description
When playing around with the ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE flag for buffer allocation I noticed the following:
If I request a buffer to be allocated with a size larger than my system allows (in my case 26GB), I get an error with 0x78000009 (size argument is not supported by the device ). Which is expected.
For context, this is the output of the device memory properties of my system:
stype : DEVICE_MEMORY_PROPERTIES
pNext : 0x0
flags : Device::{ ? }
maxClockRate : 0 <-- Not sure why this value is 0
maxBusWidth : 64
totalSize : 26706980864 <<- ~ 26GB
name : DDR
However, I am able to execute the allocate functions (e.g., zeMemAllocDevice) with for example, 3 buffers of 20 GB each (in total is using 60GB in global memory, which I should not be allowed to do this), So, each alloc call is requesting a buffer size smaller than the maximum global memory available but combined, it is much larger. But instead of getting an error code, I get directly a crash.
You can reproduce this using this sample code: https://github.com/jjfumero/codeBlogArticles/blob/master/april2022/levelZeroAlloc/levelZeroAlloc.cpp
Is this behaviour expected? Or have you considered/ is there anything in the Level Zero API similar to this call?
bool canBeAllocated = zeCanDeviceBufferSizeBeAllocated(context, deviceDesc, alignment, device, &buffer);
So a function that we can query for available space for a given buffer before the actual allocation.
Hardware/ Software details:
- Intel Driver: 21.38.21026
- Total RAM: 32 GB
- OpenCL 3.0
- GPU: Intel HD Graphics from i9-10885H
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the allocation behavior with the linked levelZeroAlloc.cpp sample, using zeMemAllocDevice and the ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE flag. Compare the reported DEVICE_MEMORY_PROPERTIES totalSize and 0x78000009 result with the multi-buffer crash. Done means the expected behavior and any required API guidance or change are documented and covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100