2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2019-02-27 18:39:32 +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/program/block_kernel_manager.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
#include "shared/source/helpers/debug_helpers.h"
|
2021-09-30 03:10:53 +08:00
|
|
|
#include "shared/source/program/kernel_info.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
|
|
|
|
|
|
|
void BlockKernelManager::addBlockKernelInfo(KernelInfo *blockKernelInfo) {
|
|
|
|
blockKernelInfoArray.push_back(blockKernelInfo);
|
Remove PatchTokens from KernelInfo
Use KernelDescriptor instead of patchTokens stored in KernelInfo's
patchInfo.
Removed: SPatchMediaInterfaceDescriptorLoad, SPatchAllocateLocalSurface,
SPatchMediaVFEState(slot 0), SPatchMediaVFEState(slot 1),
SPatchInterfaceDescriptorData, SPatchSamplerStateArray,
SPatchBindingTableState, SPatchDataParameterBuffer,
SPatchDataParameterStream, SPatchThreadPayload,
SPatchKernelAttributesInfo, SPatchAllocateStatelessPrivateSurface,
SPatchAllocateSyncBuffer,
SPatchAllocateStatelessConstantMemorySurfaceWithInitialization,
SPatchAllocateStatelessGlobalMemorySurfaceWithInitialization,
SPatchAllocateSystemThreadSurface.
Related-To: NEO-4729
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
2021-03-04 17:14:23 +08:00
|
|
|
blockUsesPrintf = blockKernelInfo->kernelDescriptor.kernelAttributes.flags.usesPrintf;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const KernelInfo *BlockKernelManager::getBlockKernelInfo(size_t ordinal) {
|
|
|
|
DEBUG_BREAK_IF(ordinal >= blockKernelInfoArray.size());
|
|
|
|
return blockKernelInfoArray[ordinal];
|
|
|
|
}
|
|
|
|
|
|
|
|
BlockKernelManager::~BlockKernelManager() {
|
|
|
|
for (auto &i : blockKernelInfoArray)
|
|
|
|
delete i;
|
|
|
|
}
|
|
|
|
void BlockKernelManager::pushPrivateSurface(GraphicsAllocation *allocation, size_t ordinal) {
|
|
|
|
if (blockPrivateSurfaceArray.size() < blockKernelInfoArray.size()) {
|
2019-07-29 19:35:55 +08:00
|
|
|
blockPrivateSurfaceArray.resize(blockKernelInfoArray.size(), nullptr);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_BREAK_IF(ordinal >= blockPrivateSurfaceArray.size());
|
|
|
|
|
|
|
|
blockPrivateSurfaceArray[ordinal] = allocation;
|
|
|
|
}
|
|
|
|
|
|
|
|
GraphicsAllocation *BlockKernelManager::getPrivateSurface(size_t ordinal) {
|
|
|
|
// Ff queried ordinal is out of bound return nullptr,
|
|
|
|
// this happens when no private surface was not pushed
|
|
|
|
if (ordinal < blockPrivateSurfaceArray.size())
|
|
|
|
return blockPrivateSurfaceArray[ordinal];
|
|
|
|
return nullptr;
|
|
|
|
}
|
2018-03-27 15:24:26 +08:00
|
|
|
void BlockKernelManager::makeInternalAllocationsResident(CommandStreamReceiver &commandStreamReceiver) {
|
|
|
|
auto blockCount = blockKernelInfoArray.size();
|
|
|
|
for (uint32_t surfaceIndex = 0; surfaceIndex < blockCount; surfaceIndex++) {
|
|
|
|
auto surface = getPrivateSurface(surfaceIndex);
|
|
|
|
if (surface) {
|
|
|
|
commandStreamReceiver.makeResident(*surface);
|
|
|
|
}
|
|
|
|
surface = blockKernelInfoArray[surfaceIndex]->getGraphicsAllocation();
|
|
|
|
if (surface) {
|
|
|
|
commandStreamReceiver.makeResident(*surface);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-17 19:31:23 +08:00
|
|
|
} // namespace NEO
|