24 template<USMKindTarget target>
26 size_t sz, std::shared_ptr<DeviceScheduler> dev_sched, std::optional<size_t> alignment) {
28 sycl::context &sycl_ctx = dev_sched->ctx->ctx;
29 sycl::device &dev = dev_sched->ctx->device->dev;
32 return USMPtrHolder<target>(usm_ptr, sz, dev_sched);
35 template<USMKindTarget target>
37 std::shared_ptr<DeviceScheduler> dev_sched) {
39 sycl::context &sycl_ctx = dev_sched->ctx->ctx;
40 sycl::device &dev = dev_sched->ctx->device->dev;
41 void *usm_ptr =
nullptr;
46 template<USMKindTarget target>
48 if (usm_ptr !=
nullptr) {
54 template<USMKindTarget target>
This file contains the declaration of the USMPtrHolder class.
Class for holding a USM pointer.
size_t get_bytesize() const
Get the size of the USM allocation (in byte).
void free_ptr()
Free the held pointer.
~USMPtrHolder()
USM pointer holder destructor.
static USMPtrHolder create(size_t sz, std::shared_ptr< DeviceScheduler > dev_sched, std::optional< size_t > alignment=std::nullopt)
Create a USM pointer holder.
This file contains the methods to actually allocate memory.
void * internal_alloc(size_t sz, const std::shared_ptr< DeviceScheduler > &dev_sched, std::optional< size_t > alignment)
Allocate a USM pointer with at least the given size in bytes.
void internal_free(void *usm_ptr, size_t sz, const std::shared_ptr< DeviceScheduler > &dev_sched)
Free a USM pointer.
namespace for backends this one is named only sham since shambackends is too long to write