Files
compute-runtime/opencl/source/command_queue/finish.h
Kamil Kopryk 2a3bd7cd03 fix: add deferred l3 flush tag in kernels
Related-To: NEO-13163
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
2025-08-22 12:56:47 +02:00

52 lines
1.3 KiB
C++

/*
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/wait_status.h"
#include "opencl/source/command_queue/command_queue_hw.h"
namespace NEO {
template <typename GfxFamily>
cl_int CommandQueueHw<GfxFamily>::finish() {
auto &csr = getGpgpuCommandStreamReceiver();
auto result = csr.flushBatchedSubmissions();
if (!result) {
return CL_OUT_OF_RESOURCES;
}
bool waitForTaskCountRequired = false;
if (l3FlushAfterPostSyncEnabled && this->checkIfDeferredL3FlushIsNeeded && this->l3FlushDeferredIfNeeded) {
csr.flushTagUpdate();
CompletionStamp completionStamp = {
csr.peekTaskCount(),
std::max(this->taskLevel, csr.peekTaskLevel()),
csr.obtainCurrentFlushStamp()};
this->updateFromCompletionStamp(completionStamp, nullptr);
this->l3FlushDeferredIfNeeded = false;
waitForTaskCountRequired = true;
}
// Stall until HW reaches taskCount on all its engines
const auto waitStatus = waitForAllEngines(true, nullptr, waitForTaskCountRequired);
if (waitStatus == WaitStatus::gpuHang) {
return CL_OUT_OF_RESOURCES;
}
return CL_SUCCESS;
}
} // namespace NEO