From 6577d4223377888f82635a3277859f18e3db4062 Mon Sep 17 00:00:00 2001 From: Rajiv Deodhar Date: Tue, 1 Feb 2022 14:01:53 -0800 Subject: [PATCH 1/2] [SYCL] Change USM pooling parameters. Signed-off-by: Rajiv Deodhar --- sycl/plugins/level_zero/usm_allocator.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/sycl/plugins/level_zero/usm_allocator.cpp b/sycl/plugins/level_zero/usm_allocator.cpp index df95a9ba8023e..c248721270d73 100644 --- a/sycl/plugins/level_zero/usm_allocator.cpp +++ b/sycl/plugins/level_zero/usm_allocator.cpp @@ -103,21 +103,21 @@ static class SetLimits { // Minimum allocation size that will be requested from the system. // By default this is the minimum allocation size of each memory type. // Memory types are host, device, shared. - size_t SlabMinSize[3] = {64 * 1024, 64 * 1024, 2 * 1024 * 1024}; + size_t SlabMinSize[3] = {64 * 1024, 2 * 1024 * 1024, 2 * 1024 * 1024}; // Allocations up to this limit will be subject to chunking/pooling - size_t MaxPoolableSize[3] = {0, 32 * 1024, 0}; + size_t MaxPoolableSize[3] = {2 * 1024 * 1024, 4 * 1024 * 1024, 0}; // When pooling, each bucket will hold a max of 4 unfreed slabs - size_t Capacity[3] = {0, 0, 0}; + size_t Capacity[3] = {4, 4, 0}; // Maximum memory left unfreed in pool - size_t MaxPoolSize = 0; + size_t MaxPoolSize = 16 * 1024 * 1024; size_t CurPoolSize = 0; size_t CurPoolSizes[3] = {0, 0, 0}; - bool EnableBuffers = false; + bool EnableBuffers = true; // Whether to print pool usage statistics int PoolTrace = 0; @@ -134,17 +134,16 @@ static class SetLimits { // pool size for all contexts. // Duplicate specifications will result in the right-most taking effect. // - // Current defaults are to match pre-2021.3 pooling. // EnableBuffers: Apply chunking/pooling to SYCL buffers. - // Default 0 (false). + // Default true. // MaxPoolSize: Limit on overall unfreed memory. - // Default 0MB. + // Default 16MB. // MaxPoolableSize: Maximum allocation size subject to chunking/pooling. - // Default 32KB. + // Default 2MB host, 4MB device and 0 shared. // Capacity: Maximum number of unfreed allocations in each bucket. - // Default 0. + // Default 4. // SlabMinSize: Minimum allocation size requested from USM. - // Default 64KB. + // Default 64KB host and 2MB device/shared. // // Example of usage: // SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=1;32M;host:1M,4,64K;device:1M,4,64K;shared:0,0,2M From f39d70d9d460a6efb2ec6c4e21b57d5cab9f01aa Mon Sep 17 00:00:00 2001 From: Rajiv Deodhar Date: Thu, 10 Feb 2022 08:03:13 -0800 Subject: [PATCH 2/2] Change to 64KB minimum slab size on device. --- sycl/plugins/level_zero/usm_allocator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/plugins/level_zero/usm_allocator.cpp b/sycl/plugins/level_zero/usm_allocator.cpp index c248721270d73..ebf720a1ef9fb 100644 --- a/sycl/plugins/level_zero/usm_allocator.cpp +++ b/sycl/plugins/level_zero/usm_allocator.cpp @@ -103,7 +103,7 @@ static class SetLimits { // Minimum allocation size that will be requested from the system. // By default this is the minimum allocation size of each memory type. // Memory types are host, device, shared. - size_t SlabMinSize[3] = {64 * 1024, 2 * 1024 * 1024, 2 * 1024 * 1024}; + size_t SlabMinSize[3] = {64 * 1024, 64 * 1024, 2 * 1024 * 1024}; // Allocations up to this limit will be subject to chunking/pooling size_t MaxPoolableSize[3] = {2 * 1024 * 1024, 4 * 1024 * 1024, 0}; @@ -143,7 +143,7 @@ static class SetLimits { // Capacity: Maximum number of unfreed allocations in each bucket. // Default 4. // SlabMinSize: Minimum allocation size requested from USM. - // Default 64KB host and 2MB device/shared. + // Default 64KB host and device, 2MB shared. // // Example of usage: // SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR=1;32M;host:1M,4,64K;device:1M,4,64K;shared:0,0,2M