sycl::malloc_shared
void* sycl::malloc_shared( size_t num_bytes, const sycl::queue& q );
template <typename T> T* sycl::malloc_shared( size_t count, const sycl::queue& q );
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 that provides the device and context to allocate against |
Returns a pointer to the newly allocated shared memory on the device associated with q on success. Memory allocated by sycl::malloc_shared must be deallocated with sycl::free in order to avoid memory leaks.
Returns nullptr on failure.