mirror of
https://github.com/intel/compute-runtime.git
synced 2025-06-28 17:58:30 +08:00

Change-Id: I6f1e0115b9c45f89afb86f8fd2304604243541df Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
35 lines
842 B
C++
35 lines
842 B
C++
/*
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
#include "opencl/source/command_queue/command_queue_hw.h"
|
|
|
|
namespace NEO {
|
|
|
|
template <typename GfxFamily>
|
|
cl_int CommandQueueHw<GfxFamily>::finish() {
|
|
auto result = getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
|
|
if (!result) {
|
|
return CL_OUT_OF_RESOURCES;
|
|
}
|
|
|
|
//as long as queue is blocked we need to stall.
|
|
while (isQueueBlocked())
|
|
;
|
|
|
|
auto taskCountToWaitFor = this->taskCount;
|
|
auto flushStampToWaitFor = this->flushStamp->peekStamp();
|
|
|
|
// Stall until HW reaches CQ taskCount
|
|
waitUntilComplete(taskCountToWaitFor, this->bcsTaskCount, flushStampToWaitFor, false);
|
|
|
|
return CL_SUCCESS;
|
|
}
|
|
} // namespace NEO
|