malloc Functions
Contents
malloc
Functions#
sycl::malloc_device
#
void* sycl::malloc_device(size_t numBytes,
const device& syclDevice,
const context& syclContext,
const property_list &propList = {})
template <typename T>
T* sycl::malloc_device(size_t count,
const device& syclDevice,
const context& syclContext,
const property_list &propList = {})
void* sycl::malloc_device(size_t numBytes,
const queue& syclQueue,
const property_list &propList = {})
template <typename T>
T* sycl::malloc_device(size_t count,
const queue& syclQueue,
const property_list &propList = {})
void* sycl::aligned_alloc_device(size_t alignment,
size_t numBytes,
const device& syclDevice,
const context& syclContext,
const property_list &propList = {})
template <typename T>
T* sycl::aligned_alloc_device(size_t alignment,
size_t count,
const device& syclDevice,
const context& syclContext,
const property_list &propList = {})
Parameters
|
alignment of allocated data |
|
allocation size in bytes |
|
number of elements |
|
See sycl::device |
|
See sycl::queue |
|
See sycl::context |
|
Returns a pointer to the newly allocated memory on the specified
device on success. This memory is not accessible on the host. Memory
allocated by sycl::malloc_device must be
deallocated with sycl::free to avoid memory
leaks. If ctxt
is a host context, it should behave as if calling
sycl::malloc_host. On failure, returns
nullptr
.
The host may not directly reference the memory, but can read and write the memory with sycl::queue member functions (memset, memcpy, fill) or sycl::handler member functions (memset, memcpy, and fill).
See Example 1 for usage.
See also
sycl::malloc_host
#
void* sycl::malloc_host(size_t numBytes,
const context& syclContext,
const property_list &propList = {})
template <typename T>
T* sycl::malloc_host(size_t count,
const context& syclContext,
const property_list &propList = {})
void* sycl::malloc_host(size_t numBytes,
const queue& syclQueue,
const property_list &propList = {})
template <typename T>
T* sycl::malloc_host(size_t count,
const queue& syclQueue,
const property_list &propList = {})
void* sycl::aligned_alloc_host(size_t alignment,
size_t numBytes,
const context& syclContext,
const property_list &propList = {})
template <typename T>
T* sycl::aligned_alloc_host(size_t alignment,
size_t count,
const context& syclContext,
const property_list &propList = {})
void* sycl::aligned_alloc_host(size_t alignment,
size_t numBytes,
const queue& syclQueue,
const property_list &propList = {})
template <typename T>
void* sycl::aligned_alloc_host(size_t alignment,
size_t count,
const queue& syclQueue,
const property_list &propList = {})
Parameters
|
alignment of allocated data |
|
allocation size in bytes |
|
number of elements |
|
See sycl::device |
|
See sycl::queue |
|
See sycl::context |
|
Returns a pointer to the newly allocated host memory on success. Host
and device may reference the memory. Memory allocated by
sycl::malloc_host must be deallocated with
sycl::free to avoid memory leaks. On failure,
returns nullptr
.
See also
sycl::malloc
#
void *malloc(size_t numBytes,
const sycl::device& syclDevice,
const sycl::context& syclContext,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
template <typename T>
T *malloc(size_t count,
const sycl::device& syclDevice,
const sycl::context& syclContext,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
void *malloc(size_t numBytes,
const sycl::queue& syclQueue,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
template <typename T>
T *malloc(size_t count,
const sycl::queue& syclQueue,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
void *aligned_alloc(size_t alignment,
size_t numBytes,
const sycl::device& syclDevice,
const sycl::context& syclContext,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
template <typename T>
T* aligned_alloc(size_t alignment,
size_t count,
const sycl::device& syclDevice,
const sycl::context& syclContext,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
void *aligned_alloc(size_t alignment,
size_t numBytes,
const sycl::queue& syclQueue,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
template <typename T>
T* aligned_alloc(size_t alignment,
size_t count,
const sycl::queue& syclQueue,
sycl::usm::alloc kind,
const sycl::property_list &propList = {})
Parameters
|
alignment of allocated data |
|
allocation size in bytes |
|
number of elements |
|
See sycl::device |
|
See sycl::queue |
|
See sycl::context |
|
See sycl::usm::alloc |
|
See also
sycl::free
#
void free(void* ptr, sycl::context& context);
void free(void* ptr, sycl::queue& q);
Free memory allocated by sycl::malloc_device, sycl::malloc_host, or sycl::malloc_shared.
See Example 1 for usage.
See also