2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-12-01 17:12:59 +08:00
|
|
|
* Copyright (C) 2018-2023 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
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
2022-02-28 18:24:05 +08:00
|
|
|
#include "shared/source/command_stream/wait_status.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_queue/command_queue_hw.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
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-11-24 21:50:41 +08:00
|
|
|
auto result = getGpgpuCommandStreamReceiver().flushBatchedSubmissions();
|
|
|
|
if (!result) {
|
|
|
|
return CL_OUT_OF_RESOURCES;
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-09-22 23:07:20 +08:00
|
|
|
// Stall until HW reaches taskCount on all its engines
|
2022-02-28 18:24:05 +08:00
|
|
|
const auto waitStatus = waitForAllEngines(true, nullptr);
|
2023-12-01 17:12:59 +08:00
|
|
|
if (waitStatus == WaitStatus::gpuHang) {
|
2022-02-28 18:24:05 +08:00
|
|
|
return CL_OUT_OF_RESOURCES;
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
return CL_SUCCESS;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|