2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2022-02-28 10:24:05 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
2022-02-28 10:24:05 +00:00
|
|
|
#include "shared/source/command_stream/wait_status.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/command_queue/command_queue_hw.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-09-13 10:11:17 +02:00
|
|
|
cl_int CommandQueueHw<GfxFamily>::finish() {
|
2019-11-24 14:50:41 +01:00
|
|
|
auto result = getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
|
|
|
|
if (!result) {
|
|
|
|
return CL_OUT_OF_RESOURCES;
|
|
|
|
}
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2021-09-22 15:07:20 +00:00
|
|
|
// Stall until HW reaches taskCount on all its engines
|
2022-02-28 10:24:05 +00:00
|
|
|
const auto waitStatus = waitForAllEngines(true, nullptr);
|
|
|
|
if (waitStatus == WaitStatus::GpuHang) {
|
|
|
|
return CL_OUT_OF_RESOURCES;
|
|
|
|
}
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
return CL_SUCCESS;
|
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|