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

Function addDeviceContext

src/backend/oneapi/platform.cpp:421–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421void addDeviceContext(sycl::device& dev, sycl::context& ctx, sycl::queue& que) {
422 DeviceManager& devMngr = DeviceManager::getInstance();
423
424 int nDevices = 0;
425 {
426 common::lock_guard_t lock(devMngr.deviceMutex);
427
428 auto tDevice = make_unique<sycl::device>(dev);
429 auto tContext = make_unique<sycl::context>(ctx);
430 // queue atleast has implicit context and device if created
431 auto tQueue = make_unique<sycl::queue>(que);
432
433 devMngr.mPlatforms.push_back(getPlatformEnum(*tDevice));
434 // FIXME: add OpenGL Interop for user provided contexts later
435 devMngr.mIsGLSharingOn.push_back(false);
436 devMngr.mDeviceTypes.push_back(static_cast<int>(
437 tDevice->get_info<sycl::info::device::device_type>()));
438
439 devMngr.mDevices.push_back(move(tDevice));
440 devMngr.mContexts.push_back(move(tContext));
441 devMngr.mQueues.push_back(move(tQueue));
442 nDevices = static_cast<int>(devMngr.mDevices.size()) - 1;
443
444 // TODO: cache?
445 }
446
447 // Last/newly added device needs memory management
448 memoryManager().addMemoryManagement(nDevices);
449}
450
451void setDeviceContext(sycl::device& dev, sycl::context& ctx) {
452 // FIXME: add OpenGL Interop for user provided contexts later

Callers

nothing calls this directly

Calls 2

getPlatformEnumFunction · 0.70
addMemoryManagementMethod · 0.45

Tested by

no test coverage detected