fix: make initializeEngine() thread-safe

Related-To: NEO-15630

Signed-off-by: Jakub Nowacki <jakub.nowacki@intel.com>
This commit is contained in:
Jakub Nowacki
2025-09-15 15:35:18 +00:00
committed by Compute-Runtime-Automation
parent 41a63a0907
commit a5025edc20
2 changed files with 16 additions and 15 deletions

View File

@@ -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;

View File

@@ -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);