mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
fix: make initializeEngine() thread-safe
Related-To: NEO-15630 Signed-off-by: Jakub Nowacki <jakub.nowacki@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
41a63a0907
commit
a5025edc20
@@ -152,11 +152,14 @@ const std::string AUBCommandStreamReceiverHw<GfxFamily>::getFileName() {
|
||||
|
||||
template <typename GfxFamily>
|
||||
void AUBCommandStreamReceiverHw<GfxFamily>::initializeEngine() {
|
||||
auto streamLocked = lockStream();
|
||||
isEngineInitialized = true;
|
||||
|
||||
if (hardwareContextController) {
|
||||
hardwareContextController->initialize();
|
||||
if (!isEngineInitialized) {
|
||||
auto streamLocked = lockStream();
|
||||
if (!isEngineInitialized) {
|
||||
isEngineInitialized = true;
|
||||
if (hardwareContextController) {
|
||||
hardwareContextController->initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,9 +318,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isEngineInitialized) {
|
||||
initializeEngine();
|
||||
}
|
||||
initializeEngine();
|
||||
|
||||
bool ownsLock = !gfxAllocation.isLocked();
|
||||
uint64_t gpuAddress;
|
||||
|
||||
@@ -129,11 +129,13 @@ void TbxCommandStreamReceiverHw<GfxFamily>::protectCPUMemoryFromWritesIfTbxFault
|
||||
|
||||
template <typename GfxFamily>
|
||||
void TbxCommandStreamReceiverHw<GfxFamily>::initializeEngine() {
|
||||
isEngineInitialized = true;
|
||||
if (!isEngineInitialized) {
|
||||
isEngineInitialized = true;
|
||||
|
||||
if (hardwareContextController) {
|
||||
hardwareContextController->initialize();
|
||||
return;
|
||||
if (hardwareContextController) {
|
||||
hardwareContextController->initialize();
|
||||
return;
|
||||
}
|
||||
}
|
||||
DEBUG_BREAK_IF(this->aubManager);
|
||||
}
|
||||
@@ -270,9 +272,7 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::writeMemory(GraphicsAllocation &gfxA
|
||||
|
||||
this->protectCPUMemoryFromWritesIfTbxFaultable(&gfxAllocation, cpuAddress, size);
|
||||
|
||||
if (!isEngineInitialized) {
|
||||
initializeEngine();
|
||||
}
|
||||
initializeEngine();
|
||||
|
||||
if (aubManager) {
|
||||
this->writeMemoryWithAubManager(gfxAllocation, isChunkCopy, gpuVaChunkOffset, chunkSize);
|
||||
|
||||
Reference in New Issue
Block a user