You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL] USM shared memory allocator for L0 plugin (#2366)
* [SYCL] USM shared memory allocator for L0 plugin
In L0 each allocation results in at least a memory page
no matter how small the size was requested. This adds
significant overhead when an app does many small allocations.
This patch adds a memory allocator on top of L0 USM API in
order to solve the problem.
High level description:
There is a predefine list of bucket sizes. When allocation function
is called, the best fitted bucket is found for the requested size.
If there is a free chunk in the bucket then it's returned, otherwise
a new slab of size 64k requested from the system via L0 API.
This slab is split into chunks of the size of corresponding bucket.
Now there is a free chunk in the slab which is returned.
When a chunk is returned it's marked as non-free until the user
call free with a corresponding pointer.
In addition to that add an environment variable
SYCL_PI_LEVEL0_DISABLE_USM_ALLOCATOR which disables the allocator
and returns back to the original behavior.
* [SYCL] Restrict USM allocators tests to Level zero
There are issues with running these tests on OpenCL
on windows.
The primary goal of these tests is to test USM allocator
which is currently emabled only for Level zero, so disable
them on OpenCL for now.
* [SYCL] Fix pointer alignment
Due to incorrect pointer alignment in case when
allcation alignment > size we returned to the user
and incorrect chunk(i.e. next to the one which was
marked as non-free) which is later detected as "double free"
error.
Also corrected the existing testcases to test this scenario
Copy file name to clipboardExpand all lines: sycl/doc/EnvironmentVariables.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@ subject to change. Do not rely on these variables in production code.
26
26
| SYCL_QUEUE_THREAD_POOL_SIZE | Positive integer | Number of threads in thread pool of queue. |
27
27
| SYCL_DEVICELIB_NO_FALLBACK | Any(\*) | Disable loading and linking of device library images |
28
28
| SYCL_PI_LEVEL0_MAX_COMMAND_LIST_CACHE | Positive integer | Maximum number of oneAPI Level Zero Command lists that can be allocated with no reuse before throwing an "out of resources" error. Default is 20000, threshold may be increased based on resource availabilty and workload demand. |
29
+
| SYCL_PI_LEVEL0_DISABLE_USM_ALLOCATOR | Any(\*) | Disable USM allocator in Level Zero plugin (each memory request will go directly to Level Zero runtime) |
29
30
30
31
`(*) Note: Any means this environment variable is effective when set to any non-null value.`
0 commit comments