![]() |
Shamrock 2025.10.0
Astrophysical Code
|
This file contains the declaration of the memory handling and its methods. More...
#include "shambackends/MemPerfInfos.hpp"#include "shambackends/USMPtrHolder.hpp"#include "shambackends/details/BufferEventHandler.hpp"#include "shambackends/details/internal_alloc.hpp"
Include dependency graph for memoryHandle.hpp:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Namespaces | |
| namespace | sham |
| namespace for backends this one is named only sham since shambackends is too long to write | |
Functions | |
| template<USMKindTarget target> | |
| USMPtrHolder< target > | sham::details::create_usm_ptr (size_t size, std::shared_ptr< DeviceScheduler > dev_sched, std::optional< size_t > alignment=std::nullopt) |
| Create a USM pointer with at least the given size in bytes. | |
| template<USMKindTarget target> | |
| void | sham::details::release_usm_ptr (USMPtrHolder< target > &&usm_ptr_hold, details::BufferEventHandler &&events) |
| Release a USM pointer. | |
This file contains the declaration of the memory handling and its methods.
The memoryHandle class is used to allocate SYCL memory. It provides a way to safely allocate, use, and deallocate memory in SYCL. This file should always be used to allocate SYCL memory, as it ensures correct memory management (including memory pooling).
To allocate SYCL memory, use the create_usm_ptr method . Here is an example:
After using the SYCL memory, make sure to deallocate it using the deallocate_usm_ptr method.
The memoryHandle class uses the USMPtrHolder class to manage the memory. The USMPtrHolder class is a smart pointer that manages the memory allocated using SYCL unified shared memory (USM). It provides a way to safely allocate, use, and deallocate memory in USM.
Definition in file memoryHandle.hpp.
| USMPtrHolder< target > sham::details::create_usm_ptr | ( | size_t | size, |
| std::shared_ptr< DeviceScheduler > | dev_sched, | ||
| std::optional< size_t > | alignment = std::nullopt |
||
| ) |
Create a USM pointer with at least the given size in bytes.
| target | The target of the USM pointer. |
| size | The size of the pointer in bytes. |
| dev_sched | Pointer to the device scheduler. |
| alignment | The alignment of the USM pointer (optional). |
Definition at line 30 of file memoryHandle.cpp.
Here is the call graph for this function:| void sham::details::release_usm_ptr | ( | USMPtrHolder< target > && | usm_ptr_hold, |
| details::BufferEventHandler && | events | ||
| ) |
Release a USM pointer.
| target | The target of the USM pointer. |
| usm_ptr_hold | The USM pointer holder to release. |
| events | The event handler to wait for completion. |
Definition at line 47 of file memoryHandle.cpp.
Here is the call graph for this function: