modify printPrintfOutput to be an atomic operation

Mutex was added to kernel_imp for atomic operation during
printPrintfOutput on kernel.

Related-To: LOCI-3681

Signed-off-by: Zhang, Winston <winston.zhang@intel.com>
This commit is contained in:
Zhang, Winston
2023-03-01 20:36:14 +00:00
committed by Compute-Runtime-Automation
parent bd32b21f7c
commit c584d19a6c
2 changed files with 3 additions and 0 deletions

View File

@@ -974,6 +974,7 @@ void KernelImp::createPrintfBuffer() {
}
void KernelImp::printPrintfOutput(bool hangDetected) {
std::lock_guard<std::mutex> lock(this->printfLock);
PrintfHandler::printOutput(kernelImmData, this->printfBuffer, module->getDevice(), hangDetected);
}

View File

@@ -14,6 +14,7 @@
#include "level_zero/core/source/kernel/kernel.h"
#include <memory>
#include <mutex>
namespace L0 {
@@ -230,6 +231,7 @@ struct KernelImp : Kernel {
std::unique_ptr<NEO::ImplicitArgs> pImplicitArgs;
std::unique_ptr<KernelExt> pExtension;
std::mutex printfLock;
};
} // namespace L0