oneapi-src / oneapi-src/unified-runtime

SYCL_PI_LEVEL_ZERO_USM_ALLOCATOR: presence of device in env change behavior of shared

Open
#2,544 1 comment 0 reactions 1 assignee View on GitHub

@bratpiorka is already working on this.

Since Jan 10, 2025.

level-zero memory umf
Dominant language
C++
Stars
57
Forks
120
Avg merge
1d 14h
Merged PRs (30d)
1

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.