Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR: presence of device in env change behavior of shared #2544

Open
Alexandr-Konovalov opened this issue Jan 10, 2025 · 0 comments
Assignees
Labels
level-zero L0 adapter specific issues memory Memory allocations/transfers/operations umf Unified Malloc Framework (prev. UMA)

Comments

@Alexandr-Konovalov
Copy link

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
@kbenzie kbenzie added memory Memory allocations/transfers/operations umf Unified Malloc Framework (prev. UMA) level-zero L0 adapter specific issues labels Jan 10, 2025
@bratpiorka bratpiorka self-assigned this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level-zero L0 adapter specific issues memory Memory allocations/transfers/operations umf Unified Malloc Framework (prev. UMA)
Projects
None yet
Development

No branches or pull requests

3 participants