Using pinned memory on orin platform,caused increase gpu memory usage

When Try to allocate pinned memory on Jetson Orin Platform,I found a huge gpu memory usage increasing ? Why ?

code for allocate about 4GB Memory

import torch
from typing import List

def _allocate_kv_cache(
) -> List[torch.Tensor]:
    """Allocates KV cache on the specified device."""
    kv_cache_shape = (4681, 2, 16, 4, 128)
    pin_memory = True
    kv_cache: List[torch.Tensor] = []
    for _ in range(28):
        # null block in CpuGpuBlockAllocator requires at least that
        # block to be zeroed-out.
        # We zero-out everything for simplicity.
        kv_cache.append(
            torch.zeros(kv_cache_shape,
                        dtype=torch.float16,
                        pin_memory=pin_memory,
                        device="cpu"))
    return kv_cache

_allocate_kv_cache()
print("haha")

Memory Usage After allocating:

And Why ?

I generally suggest that folks asking questions about pytorch do so on a pytorch forum, such as discuss.pytorch.org. There are NVIDIA CUDA experts that patrol that forum. Also, you may wish to ask Jetson questions on a relevant Jetson forum.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.