2019-10-28 02:48:26 +08:00
|
|
|
/*
|
2021-02-23 17:55:12 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-10-28 02:48:26 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/program/kernel_info_from_patchtokens.h"
|
2019-10-28 02:48:26 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/device_binary_format/patchtokens_decoder.h"
|
2020-02-25 21:52:40 +08:00
|
|
|
#include "shared/source/kernel/kernel_descriptor_from_patchtokens.h"
|
2021-09-30 03:10:53 +08:00
|
|
|
#include "shared/source/program/kernel_info.h"
|
2019-10-28 02:48:26 +08:00
|
|
|
|
2020-01-12 01:25:26 +08:00
|
|
|
#include <cstring>
|
|
|
|
|
2019-10-28 02:48:26 +08:00
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
using namespace iOpenCL;
|
|
|
|
|
2020-01-26 02:18:48 +08:00
|
|
|
void populateKernelInfo(KernelInfo &dst, const PatchTokenBinary::KernelFromPatchtokens &src, uint32_t gpuPointerSizeInBytes) {
|
2020-01-12 01:25:26 +08:00
|
|
|
UNRECOVERABLE_IF(nullptr == src.header);
|
2020-05-26 15:36:04 +08:00
|
|
|
|
|
|
|
dst.heapInfo.DynamicStateHeapSize = src.header->DynamicStateHeapSize;
|
|
|
|
dst.heapInfo.GeneralStateHeapSize = src.header->GeneralStateHeapSize;
|
|
|
|
dst.heapInfo.SurfaceStateHeapSize = src.header->SurfaceStateHeapSize;
|
|
|
|
dst.heapInfo.KernelHeapSize = src.header->KernelHeapSize;
|
|
|
|
dst.heapInfo.KernelUnpaddedSize = src.header->KernelUnpaddedSize;
|
|
|
|
dst.shaderHashCode = src.header->ShaderHashCode;
|
|
|
|
|
2019-10-28 02:48:26 +08:00
|
|
|
dst.heapInfo.pKernelHeap = src.isa.begin();
|
|
|
|
dst.heapInfo.pGsh = src.heaps.generalState.begin();
|
|
|
|
dst.heapInfo.pDsh = src.heaps.dynamicState.begin();
|
|
|
|
dst.heapInfo.pSsh = src.heaps.surfaceState.begin();
|
|
|
|
|
2021-04-08 17:05:45 +08:00
|
|
|
if (src.tokens.executionEnvironment != nullptr) {
|
|
|
|
dst.hasIndirectStatelessAccess = (src.tokens.executionEnvironment->IndirectStatelessCount > 0);
|
2019-10-28 02:48:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dst.systemKernelOffset = src.tokens.stateSip ? src.tokens.stateSip->SystemKernelOffset : 0U;
|
|
|
|
|
|
|
|
for (auto &childSimdSize : src.tokens.crossThreadPayloadArgs.childBlockSimdSize) {
|
|
|
|
dst.childrenKernelsIdOffset.push_back({childSimdSize->ArgumentNumber, childSimdSize->Offset});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src.tokens.gtpinInfo) {
|
|
|
|
dst.igcInfoForGtpin = reinterpret_cast<const gtpin::igc_info_t *>(src.tokens.gtpinInfo + 1);
|
|
|
|
}
|
|
|
|
|
2021-04-08 17:05:45 +08:00
|
|
|
populateKernelDescriptor(dst.kernelDescriptor, src, gpuPointerSizeInBytes);
|
2020-05-26 15:36:04 +08:00
|
|
|
|
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
|
|
|
if (dst.kernelDescriptor.kernelAttributes.crossThreadDataSize) {
|
|
|
|
dst.crossThreadData = new char[dst.kernelDescriptor.kernelAttributes.crossThreadDataSize];
|
|
|
|
memset(dst.crossThreadData, 0x00, dst.kernelDescriptor.kernelAttributes.crossThreadDataSize);
|
2020-01-12 01:25:26 +08:00
|
|
|
}
|
2019-10-28 02:48:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NEO
|