2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/command_queue/command_queue_hw.h"
|
|
|
|
#include "runtime/command_stream/command_stream_receiver.h"
|
|
|
|
#include "runtime/device/device.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "hw_cmds.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-09-13 16:11:17 +08:00
|
|
|
cl_int CommandQueueHw<GfxFamily>::finish() {
|
2019-07-15 20:28:09 +08:00
|
|
|
getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
//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
|
2018-03-21 17:00:49 +08:00
|
|
|
waitUntilComplete(taskCountToWaitFor, flushStampToWaitFor, false);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
return CL_SUCCESS;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|