mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add test to detect potential race
also add lock inside initialGpgpu Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
a5614a1c66
commit
fea9c9aca7
@ -130,29 +130,33 @@ CommandQueue::~CommandQueue() {
|
||||
|
||||
void CommandQueue::initializeGpgpu() const {
|
||||
if (gpgpuEngine == nullptr) {
|
||||
auto &hwInfo = device->getDevice().getHardwareInfo();
|
||||
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
static std::mutex mutex;
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (gpgpuEngine == nullptr) {
|
||||
auto &hwInfo = device->getDevice().getHardwareInfo();
|
||||
auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
auto engineRoundRobinAvailable = hwHelper.isAssignEngineRoundRobinSupported(hwInfo) &&
|
||||
this->isAssignEngineRoundRobinEnabled();
|
||||
auto engineRoundRobinAvailable = hwHelper.isAssignEngineRoundRobinSupported(hwInfo) &&
|
||||
this->isAssignEngineRoundRobinEnabled();
|
||||
|
||||
if (DebugManager.flags.EnableCmdQRoundRobindEngineAssign.get() != -1) {
|
||||
engineRoundRobinAvailable = DebugManager.flags.EnableCmdQRoundRobindEngineAssign.get();
|
||||
if (DebugManager.flags.EnableCmdQRoundRobindEngineAssign.get() != -1) {
|
||||
engineRoundRobinAvailable = DebugManager.flags.EnableCmdQRoundRobindEngineAssign.get();
|
||||
}
|
||||
|
||||
auto assignEngineRoundRobin =
|
||||
!this->isSpecialCommandQueue &&
|
||||
!this->queueFamilySelected &&
|
||||
!(getCmdQueueProperties<cl_queue_priority_khr>(propertiesVector.data(), CL_QUEUE_PRIORITY_KHR) & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_LOW_KHR)) &&
|
||||
engineRoundRobinAvailable;
|
||||
|
||||
if (assignEngineRoundRobin) {
|
||||
this->gpgpuEngine = &device->getDevice().getNextEngineForCommandQueue();
|
||||
} else {
|
||||
this->gpgpuEngine = &device->getDefaultEngine();
|
||||
}
|
||||
|
||||
this->initializeGpgpuInternals();
|
||||
}
|
||||
|
||||
auto assignEngineRoundRobin =
|
||||
!this->isSpecialCommandQueue &&
|
||||
!this->queueFamilySelected &&
|
||||
!(getCmdQueueProperties<cl_queue_priority_khr>(propertiesVector.data(), CL_QUEUE_PRIORITY_KHR) & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_LOW_KHR)) &&
|
||||
engineRoundRobinAvailable;
|
||||
|
||||
if (assignEngineRoundRobin) {
|
||||
this->gpgpuEngine = &device->getDevice().getNextEngineForCommandQueue();
|
||||
} else {
|
||||
this->gpgpuEngine = &device->getDefaultEngine();
|
||||
}
|
||||
|
||||
this->initializeGpgpuInternals();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user