mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
Extend specialQueue in context to StackVec
Related-To: NEO-4589 Change-Id: I92db4cf8511e13a35307a4f48b51041a6fc7330f Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
430cca3f4c
commit
2c1551d40d
@@ -49,8 +49,11 @@ Context::Context(
|
||||
|
||||
Context::~Context() {
|
||||
delete[] properties;
|
||||
if (specialQueue) {
|
||||
delete specialQueue;
|
||||
|
||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < specialQueues.size(); rootDeviceIndex++) {
|
||||
if (specialQueues[rootDeviceIndex]) {
|
||||
delete specialQueues[rootDeviceIndex];
|
||||
}
|
||||
}
|
||||
if (svmAllocsManager) {
|
||||
delete svmAllocsManager;
|
||||
@@ -100,15 +103,15 @@ void Context::setDefaultDeviceQueue(DeviceQueue *queue) {
|
||||
defaultDeviceQueue = queue;
|
||||
}
|
||||
|
||||
CommandQueue *Context::getSpecialQueue() {
|
||||
return specialQueue;
|
||||
CommandQueue *Context::getSpecialQueue(uint32_t rootDeviceIndex) {
|
||||
return specialQueues[rootDeviceIndex];
|
||||
}
|
||||
|
||||
void Context::setSpecialQueue(CommandQueue *commandQueue) {
|
||||
specialQueue = commandQueue;
|
||||
void Context::setSpecialQueue(CommandQueue *commandQueue, uint32_t rootDeviceIndex) {
|
||||
specialQueues[rootDeviceIndex] = commandQueue;
|
||||
}
|
||||
void Context::overrideSpecialQueueAndDecrementRefCount(CommandQueue *commandQueue) {
|
||||
setSpecialQueue(commandQueue);
|
||||
void Context::overrideSpecialQueueAndDecrementRefCount(CommandQueue *commandQueue, uint32_t rootDeviceIndex) {
|
||||
setSpecialQueue(commandQueue, rootDeviceIndex);
|
||||
commandQueue->setIsSpecialCommandQueue(true);
|
||||
//decrement ref count that special queue added
|
||||
this->decRefInternal();
|
||||
@@ -197,7 +200,7 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
return false;
|
||||
}
|
||||
|
||||
this->devices = inputDevices;
|
||||
devices = inputDevices;
|
||||
for (auto &rootDeviceIndex : rootDeviceIndices) {
|
||||
DeviceBitfield deviceBitfield{};
|
||||
for (const auto &pDevice : devices) {
|
||||
@@ -210,6 +213,7 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
|
||||
if (devices.size() > 0) {
|
||||
maxRootDeviceIndex = *std::max_element(rootDeviceIndices.begin(), rootDeviceIndices.end(), std::less<uint32_t const>());
|
||||
specialQueues.resize(maxRootDeviceIndex + 1u);
|
||||
auto device = this->getDevice(0);
|
||||
this->memoryManager = device->getMemoryManager();
|
||||
if (memoryManager->isAsyncDeleterEnabled()) {
|
||||
@@ -228,9 +232,13 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
setupContextType();
|
||||
}
|
||||
|
||||
auto commandQueue = CommandQueue::create(this, devices[0], nullptr, true, errcodeRet);
|
||||
DEBUG_BREAK_IF(commandQueue == nullptr);
|
||||
overrideSpecialQueueAndDecrementRefCount(commandQueue);
|
||||
for (auto &device : devices) {
|
||||
if (!specialQueues[device->getRootDeviceIndex()]) {
|
||||
auto commandQueue = CommandQueue::create(this, device, nullptr, true, errcodeRet); // NOLINT
|
||||
DEBUG_BREAK_IF(commandQueue == nullptr);
|
||||
overrideSpecialQueueAndDecrementRefCount(commandQueue, device->getRootDeviceIndex());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ class Context : public BaseObject<_cl_context> {
|
||||
DeviceQueue *getDefaultDeviceQueue();
|
||||
void setDefaultDeviceQueue(DeviceQueue *queue);
|
||||
|
||||
CommandQueue *getSpecialQueue();
|
||||
void setSpecialQueue(CommandQueue *commandQueue);
|
||||
void overrideSpecialQueueAndDecrementRefCount(CommandQueue *commandQueue);
|
||||
CommandQueue *getSpecialQueue(uint32_t rootDeviceIndex);
|
||||
void setSpecialQueue(CommandQueue *commandQueue, uint32_t rootDeviceIndex);
|
||||
void overrideSpecialQueueAndDecrementRefCount(CommandQueue *commandQueue, uint32_t rootDeviceIndex);
|
||||
|
||||
template <typename Sharing>
|
||||
Sharing *getSharing();
|
||||
@@ -194,7 +194,7 @@ class Context : public BaseObject<_cl_context> {
|
||||
void *userData = nullptr;
|
||||
MemoryManager *memoryManager = nullptr;
|
||||
SVMAllocsManager *svmAllocsManager = nullptr;
|
||||
CommandQueue *specialQueue = nullptr;
|
||||
StackVec<CommandQueue *, 1> specialQueues;
|
||||
DeviceQueue *defaultDeviceQueue = nullptr;
|
||||
DriverDiagnostics *driverDiagnostics = nullptr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user