2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-02-16 22:28:59 +08:00
|
|
|
* Copyright (C) 2017-2021 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"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
bool DispatchInfo::usesSlm() const {
|
2020-12-18 22:47:42 +08:00
|
|
|
return (kernel == nullptr) ? false : kernel->getSlmTotalSize(pClDevice->getRootDeviceIndex()) > 0;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DispatchInfo::usesStatelessPrintfSurface() const {
|
2021-02-16 22:28:59 +08:00
|
|
|
return (kernel == nullptr) ? false : kernel->hasPrintfOutput(pClDevice->getRootDeviceIndex());
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t DispatchInfo::getRequiredScratchSize() const {
|
2020-12-08 20:11:40 +08:00
|
|
|
return (kernel == nullptr) ? 0 : kernel->getScratchSize(pClDevice->getRootDeviceIndex());
|
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 {
|
2020-12-08 20:11:40 +08:00
|
|
|
return (kernel == nullptr) ? 0 : kernel->getPrivateScratchSize(pClDevice->getRootDeviceIndex());
|
2019-06-28 15:37:04 +08:00
|
|
|
}
|
|
|
|
|
2018-08-16 21:47:25 +08:00
|
|
|
Kernel *MultiDispatchInfo::peekMainKernel() const {
|
|
|
|
if (dispatchInfos.size() == 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mainKernel ? mainKernel : dispatchInfos.begin()->getKernel();
|
|
|
|
}
|
|
|
|
|
|
|
|
Kernel *MultiDispatchInfo::peekParentKernel() const {
|
|
|
|
return (mainKernel && mainKernel->isParentKernel) ? mainKernel : nullptr;
|
|
|
|
}
|
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
|