MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / af_alloc_device_v2

Function af_alloc_device_v2

src/api/c/memory.cpp:260–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260af_err af_alloc_device_v2(void **ptr, const dim_t bytes) {
261 try {
262 AF_CHECK(af_init());
263#ifdef AF_OPENCL
264 auto *buf = static_cast<cl::Buffer *>(memAllocUser(bytes));
265 *ptr = buf->operator()();
266
267 // Calling retain to offset the decrement the reference count by the
268 // destructor of cl::Buffer
269 clRetainMemObject(cl_mem(*ptr));
270 delete buf;
271#else
272 *ptr = static_cast<void *>(memAllocUser(bytes));
273#endif
274 }
275 CATCHALL;
276 return AF_SUCCESS;
277}
278
279af_err af_alloc_pinned(void **ptr, const dim_t bytes) {
280 try {

Callers 3

TESTFunction · 0.50
TESTFunction · 0.50
allocV2Function · 0.50

Calls 3

af_initFunction · 0.70
memAllocUserFunction · 0.50
operator()Method · 0.45

Tested by

no test coverage detected