2019-05-13 20:15:03 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-05-13 20:15:03 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/engine_node_helper.h"
|
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_queue/hardware_interface_base.inl"
|
2019-05-13 20:15:03 +08:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
inline void HardwareInterface<GfxFamily>::getDefaultDshSpace(
|
|
|
|
const size_t &offsetInterfaceDescriptorTable,
|
|
|
|
CommandQueue &commandQueue,
|
|
|
|
const MultiDispatchInfo &multiDispatchInfo,
|
|
|
|
size_t &totalInterfaceDescriptorTableSize,
|
|
|
|
Kernel *parentKernel,
|
|
|
|
IndirectHeap *dsh,
|
|
|
|
LinearStream *commandStream) {
|
|
|
|
|
|
|
|
size_t numDispatches = multiDispatchInfo.size();
|
|
|
|
totalInterfaceDescriptorTableSize *= numDispatches;
|
|
|
|
|
|
|
|
if (!parentKernel) {
|
|
|
|
dsh->getSpace(totalInterfaceDescriptorTableSize);
|
|
|
|
} else {
|
|
|
|
dsh->getSpace(commandQueue.getContext().getDefaultDeviceQueue()->getDshOffset() - dsh->getUsed());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
inline void HardwareInterface<GfxFamily>::dispatchWorkarounds(
|
|
|
|
LinearStream *commandStream,
|
|
|
|
CommandQueue &commandQueue,
|
|
|
|
Kernel &kernel,
|
|
|
|
const bool &enable) {
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
|
PreemptionHelper::applyPreemptionWaCmdsBegin<GfxFamily>(commandStream, commandQueue.getDevice());
|
|
|
|
// Implement enabling special WA DisableLSQCROPERFforOCL if needed
|
|
|
|
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
|
|
|
|
} else {
|
|
|
|
// Implement disabling special WA DisableLSQCROPERFforOCL if needed
|
|
|
|
GpgpuWalkerHelper<GfxFamily>::applyWADisableLSQCROPERFforOCL(commandStream, kernel, enable);
|
|
|
|
PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(commandStream, commandQueue.getDevice());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
inline void HardwareInterface<GfxFamily>::programWalker(
|
|
|
|
LinearStream &commandStream,
|
|
|
|
Kernel &kernel,
|
|
|
|
CommandQueue &commandQueue,
|
|
|
|
TimestampPacketContainer *currentTimestampPacketNodes,
|
|
|
|
IndirectHeap &dsh,
|
|
|
|
IndirectHeap &ioh,
|
|
|
|
IndirectHeap &ssh,
|
|
|
|
size_t globalWorkSizes[3],
|
|
|
|
size_t localWorkSizes[3],
|
|
|
|
PreemptionMode preemptionMode,
|
|
|
|
size_t currentDispatchIndex,
|
|
|
|
uint32_t &interfaceDescriptorIndex,
|
|
|
|
const DispatchInfo &dispatchInfo,
|
|
|
|
size_t offsetInterfaceDescriptorTable,
|
|
|
|
Vec3<size_t> &numberOfWorkgroups,
|
|
|
|
Vec3<size_t> &startOfWorkgroups) {
|
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
auto walkerCmdBuf = allocateWalkerSpace(commandStream, kernel);
|
|
|
|
WALKER_TYPE<GfxFamily> walkerCmd = GfxFamily::cmdInitGpgpuWalker;
|
2019-05-13 20:15:03 +08:00
|
|
|
uint32_t dim = dispatchInfo.getDim();
|
2021-03-22 23:26:03 +08:00
|
|
|
uint32_t simd = kernel.getKernelInfo().getMaxSimdSize();
|
2019-05-13 20:15:03 +08:00
|
|
|
|
|
|
|
size_t globalOffsets[3] = {dispatchInfo.getOffset().x, dispatchInfo.getOffset().y, dispatchInfo.getOffset().z};
|
|
|
|
size_t startWorkGroups[3] = {startOfWorkgroups.x, startOfWorkgroups.y, startOfWorkgroups.z};
|
|
|
|
size_t numWorkGroups[3] = {numberOfWorkgroups.x, numberOfWorkgroups.y, numberOfWorkgroups.z};
|
|
|
|
|
2019-07-15 20:28:09 +08:00
|
|
|
if (currentTimestampPacketNodes && commandQueue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
2019-05-13 20:15:03 +08:00
|
|
|
auto timestampPacketNode = currentTimestampPacketNodes->peekNodes().at(currentDispatchIndex);
|
2020-11-24 22:20:25 +08:00
|
|
|
GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(&commandStream, &walkerCmd, timestampPacketNode, commandQueue.getDevice().getRootDeviceEnvironment());
|
2019-05-13 20:15:03 +08:00
|
|
|
}
|
|
|
|
|
2020-01-13 20:15:03 +08:00
|
|
|
auto isCcsUsed = EngineHelpers::isCcs(commandQueue.getGpgpuEngine().osContext->getEngineType());
|
2021-03-22 23:26:03 +08:00
|
|
|
auto kernelUsesLocalIds = HardwareCommandsHelper<GfxFamily>::kernelUsesLocalIds(kernel);
|
2019-10-14 19:33:18 +08:00
|
|
|
|
2019-06-12 15:13:06 +08:00
|
|
|
HardwareCommandsHelper<GfxFamily>::sendIndirectState(
|
2019-05-13 20:15:03 +08:00
|
|
|
commandStream,
|
|
|
|
dsh,
|
|
|
|
ioh,
|
|
|
|
ssh,
|
|
|
|
kernel,
|
2021-03-22 23:26:03 +08:00
|
|
|
kernel.getKernelStartOffset(true, kernelUsesLocalIds, isCcsUsed),
|
2019-05-13 20:15:03 +08:00
|
|
|
simd,
|
|
|
|
localWorkSizes,
|
|
|
|
offsetInterfaceDescriptorTable,
|
|
|
|
interfaceDescriptorIndex,
|
|
|
|
preemptionMode,
|
2020-04-28 00:55:26 +08:00
|
|
|
&walkerCmd,
|
2019-05-13 20:15:03 +08:00
|
|
|
nullptr,
|
2020-11-13 18:41:45 +08:00
|
|
|
true,
|
2020-11-19 02:39:32 +08:00
|
|
|
commandQueue.getDevice());
|
2019-05-13 20:15:03 +08:00
|
|
|
|
2021-03-22 23:26:03 +08:00
|
|
|
GpgpuWalkerHelper<GfxFamily>::setGpgpuWalkerThreadData(&walkerCmd, kernel.getKernelInfo().kernelDescriptor,
|
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
|
|
|
globalOffsets, startWorkGroups,
|
2019-05-13 20:15:03 +08:00
|
|
|
numWorkGroups, localWorkSizes, simd, dim,
|
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
|
|
|
false, false, 0u);
|
2020-04-14 15:36:39 +08:00
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
EncodeDispatchKernel<GfxFamily>::encodeAdditionalWalkerFields(commandQueue.getDevice().getHardwareInfo(), walkerCmd);
|
|
|
|
*walkerCmdBuf = walkerCmd;
|
2019-05-13 20:15:03 +08:00
|
|
|
}
|
|
|
|
} // namespace NEO
|