2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-01-02 19:14:39 +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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/helpers/dispatch_info.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/kernel/kernel.h"
|
2023-01-10 01:14:18 +08:00
|
|
|
#include "opencl/source/mem_obj/mem_obj.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2023-01-10 01:14:18 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
bool DispatchInfo::usesSlm() const {
|
2021-03-22 19:06:23 +08:00
|
|
|
return (kernel == nullptr) ? false : kernel->getSlmTotalSize() > 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DispatchInfo::usesStatelessPrintfSurface() const {
|
2021-03-22 23:26:03 +08:00
|
|
|
return (kernel == nullptr) ? false : kernel->hasPrintfOutput();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t DispatchInfo::getRequiredScratchSize() const {
|
2021-03-22 23:26:03 +08:00
|
|
|
return (kernel == nullptr) ? 0 : kernel->getScratchSize();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2018-08-16 21:47:25 +08:00
|
|
|
|
2019-06-28 15:37:04 +08:00
|
|
|
uint32_t DispatchInfo::getRequiredPrivateScratchSize() const {
|
2021-03-22 23:26:03 +08:00
|
|
|
return (kernel == nullptr) ? 0 : kernel->getPrivateScratchSize();
|
2019-06-28 15:37:04 +08:00
|
|
|
}
|
|
|
|
|
2023-01-10 01:14:18 +08:00
|
|
|
MultiDispatchInfo::~MultiDispatchInfo() {
|
|
|
|
for (MemObj *redescribedSurface : redescribedSurfaces) {
|
|
|
|
redescribedSurface->release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MultiDispatchInfo::pushRedescribedMemObj(std::unique_ptr<MemObj> memObj) {
|
|
|
|
redescribedSurfaces.push_back(memObj.release());
|
|
|
|
}
|
|
|
|
|
2018-08-16 21:47:25 +08:00
|
|
|
Kernel *MultiDispatchInfo::peekMainKernel() const {
|
|
|
|
if (dispatchInfos.size() == 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mainKernel ? mainKernel : dispatchInfos.begin()->getKernel();
|
|
|
|
}
|
|
|
|
|
2020-10-15 01:22:01 +08:00
|
|
|
void MultiDispatchInfo::backupUnifiedMemorySyncRequirement() {
|
|
|
|
for (const auto &dispatchInfo : dispatchInfos) {
|
|
|
|
dispatchInfo.getKernel()->setUnifiedMemorySyncRequirement(true);
|
|
|
|
}
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|