8000 SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR: presence of device in env change behavior of shared · Issue #2544 · oneapi-src/unified-runtime · GitHub
[go: up one dir, main page]

Skip to content
SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR: presence of device in env change behavior of shared #2544
Open
@Alexandr-Konovalov

Description

@Alexandr-Konovalov

I'm trying to use USM pooling and the results are not seems match the documentation. I see that presence of device in SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR changes pooling behavior for shared memory. I.e., with explicit device:4M (that is a default), shared memory pooling is on, while without it, there is no more pooling.

This is reproduced under Linux for release compiler 2025.0.0.20241008 as well as for manual sycl build that uses UR dbd168cb.

$ cat umf.cpp
#include <sycl/sycl.hpp>

int main() {
    sycl::queue queue;
    char *buf = sycl::aligned_alloc_shared<char>(64, 8, queue);
    for (auto iteration = 0u; iteration < 4; iteration++) {
        char *buf1 = sycl::aligned_alloc_shared<char>(64, 8, queue);
        printf("%ld\n", buf - buf1);
        buf = buf1;
    }
}

$ icpx -fsycl umf.cpp
$ SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR="1;device:4M;shared:64K,4,64K" SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR_TRACE=3 ./a.out
USM Pool Settings (Built-in or Adjusted by Environment Variable)
      Parameter        Host      Device   Shared RW   Shared RO
    SlabMinSize       65536       65536       65536     2097152
MaxPoolableSize     2097152     4194304       65536     4194304
       Capacity           4           4           4           4
    MaxPoolSize18446744073709551615
  EnableBuffers           1

Allocated        8 Shared bytes aligned at 64 from Provider ->0x7f749b6d0000
Allocated        8 Shared bytes aligned at 64 from Pool ->0x7f749b6d0200
-512
Allocated        8 Shared bytes aligned at 64 from Pool ->0x7f749b6d0400
-512
Allocated        8 Shared bytes aligned at 64 from Pool ->0x7f749b6d0600
-512
Allocated        8 Shared bytes aligned at 64 from Pool ->0x7f749b6d0800
-512
Shared memory statistics
   Bucket Size      Allocs       Frees  Allocs from Pool   Peak Slabs in Use   Peak Slabs in Pool
           512           5           0                 4                   1                    0
Current Pool Size 0
Suggested Setting=;shared:65536,1,64K
$ SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR="1;shared:64K,4,64K" SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR_TRACE=3 ./a.out
USM Pool Settings (Built-in or Adjusted by Environment Variable)
      Parameter        Host      Device   Shared RW   Shared RO
    SlabMinSize       65536       65536     2097152     2097152
MaxPoolableSize     2097152     4194304           0     4194304
       Capacity           4           4           0           4
    MaxPoolSize18446744073709551615
  EnableBuffers           1

Allocated        8 Shared bytes aligned at 64 from Provider ->0x7fe41be60000
Allocated        8 Shared bytes aligned at 64 from Provider ->0x7fe41baa0000
3932160
Allocated        8 Shared bytes aligned at 64 from Provider ->0x7fe41ba80000
131072
Allocated        8 Shared bytes aligned at 64 from Provider ->0x7fe41ba60000
131072
Allocated        8 Shared bytes aligned at 64 from Provider ->0x7fe41ba40000
131072

Metadata

Metadata

Assignees

Labels

level-zeroL0 adapter specific issuesmemoryMemory allocations/transfers/operationsumfUnified Malloc Framework (prev. UMA)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0