Restricted USM: aligned_alloc_host (2)

sycl::aligned_alloc_host

void* sycl::aligned_alloc_host(
    size_t alignment,
    size_t num_bytes,
    const sycl::queue& q
);
template <typename T>
void* sycl::aligned_alloc_host(
    size_t alignment,
    size_t count,
    const sycl::queue& q
);

Parameters

size_t alignment

Specifies the byte alignment. Must be a valid alignment supported by the implementation.

size_t num_bytes

Number of bytes to allocate.

size_t count

Number of elements of type T to allocate.

const sycl::queue& q

The SYCL q whose context contains the devices that will access the host allocation.

Return Value

Returns a pointer to the newly allocated host memory on success. Memory allocated by sycl::aligned_alloc_host must be deallocated with sycl::free in order to avoid memory leaks.

Returns nullptr on failure.