2019-05-13 20:15:03 +08:00
|
|
|
/*
|
2022-01-13 23:27:58 +08:00
|
|
|
* Copyright (C) 2019-2022 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,
|
|
|
|
IndirectHeap *dsh,
|
|
|
|
LinearStream *commandStream) {
|
|
|
|
|
|
|
|
size_t numDispatches = multiDispatchInfo.size();
|
|
|
|
totalInterfaceDescriptorTableSize *= numDispatches;
|
|
|
|
|
2022-01-13 23:27:58 +08:00
|
|
|
dsh->getSpace(totalInterfaceDescriptorTableSize);
|
2019-05-13 20:15:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
IndirectHeap &dsh,
|
|
|
|
IndirectHeap &ioh,
|
|
|
|
IndirectHeap &ssh,
|
|
|
|
const DispatchInfo &dispatchInfo,
|
2022-07-02 02:03:54 +08:00
|
|
|
HardwareInterfaceWalkerArgs &walkerArgs) {
|
2019-05-13 20:15:03 +08:00
|
|
|
|
2020-04-28 00:55:26 +08:00
|
|
|
auto walkerCmdBuf = allocateWalkerSpace(commandStream, kernel);
|
2021-11-04 23:40:13 +08:00
|
|
|
WALKER_TYPE 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};
|
2022-07-02 02:03:54 +08:00
|
|
|
size_t startWorkGroups[3] = {walkerArgs.startOfWorkgroups->x, walkerArgs.startOfWorkgroups->y, walkerArgs.startOfWorkgroups->z};
|
|
|
|
size_t numWorkGroups[3] = {walkerArgs.numberOfWorkgroups->x, walkerArgs.numberOfWorkgroups->y, walkerArgs.numberOfWorkgroups->z};
|
2022-08-03 20:22:30 +08:00
|
|
|
auto threadGroupCount = static_cast<uint32_t>(walkerArgs.numberOfWorkgroups->x * walkerArgs.numberOfWorkgroups->y * walkerArgs.numberOfWorkgroups->z);
|
2019-05-13 20:15:03 +08:00
|
|
|
|
2022-07-02 02:03:54 +08:00
|
|
|
if (walkerArgs.currentTimestampPacketNodes && commandQueue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
|
|
|
auto timestampPacketNode = walkerArgs.currentTimestampPacketNodes->peekNodes().at(walkerArgs.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,
|
2022-06-28 01:20:50 +08:00
|
|
|
kernel.getKernelStartAddress(true, kernelUsesLocalIds, isCcsUsed, false),
|
2019-05-13 20:15:03 +08:00
|
|
|
simd,
|
2022-07-02 02:03:54 +08:00
|
|
|
walkerArgs.localWorkSizes,
|
2022-08-03 20:22:30 +08:00
|
|
|
threadGroupCount,
|
2022-07-02 02:03:54 +08:00
|
|
|
walkerArgs.offsetInterfaceDescriptorTable,
|
|
|
|
walkerArgs.interfaceDescriptorIndex,
|
|
|
|
walkerArgs.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,
|
2022-07-02 02:03:54 +08:00
|
|
|
numWorkGroups, walkerArgs.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
|
|
|
|
2022-07-02 02:03:54 +08:00
|
|
|
EncodeWalkerArgs encodeWalkerArgs{kernel.getExecutionType(), false};
|
|
|
|
EncodeDispatchKernel<GfxFamily>::encodeAdditionalWalkerFields(commandQueue.getDevice().getHardwareInfo(), walkerCmd, encodeWalkerArgs);
|
2020-04-28 00:55:26 +08:00
|
|
|
*walkerCmdBuf = walkerCmd;
|
2019-05-13 20:15:03 +08:00
|
|
|
}
|
|
|
|
} // namespace NEO
|