2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2021-05-16 20:51:16 +02:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/helpers/per_thread_data.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
|
|
|
|
#include "shared/source/helpers/debug_helpers.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-08-06 11:35:59 +02:00
|
|
|
#include <array>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
size_t PerThreadDataHelper::sendPerThreadData(
|
|
|
|
|
LinearStream &indirectHeap,
|
|
|
|
|
uint32_t simd,
|
2019-12-17 08:55:09 +01:00
|
|
|
uint32_t grfSize,
|
2017-12-21 00:45:38 +01:00
|
|
|
uint32_t numChannels,
|
2020-11-04 10:34:42 +01:00
|
|
|
const std::array<uint16_t, 3> &localWorkSizes,
|
2018-08-08 12:49:36 +02:00
|
|
|
const std::array<uint8_t, 3> &workgroupWalkOrder,
|
|
|
|
|
bool hasKernelOnlyImages) {
|
2017-12-21 00:45:38 +01:00
|
|
|
auto offsetPerThreadData = indirectHeap.getUsed();
|
|
|
|
|
if (numChannels) {
|
2020-11-04 10:34:42 +01:00
|
|
|
size_t localWorkSize = static_cast<size_t>(localWorkSizes[0]) * static_cast<size_t>(localWorkSizes[1]) * static_cast<size_t>(localWorkSizes[2]);
|
2019-12-17 08:55:09 +01:00
|
|
|
auto sizePerThreadDataTotal = getPerThreadDataSizeTotal(simd, grfSize, numChannels, localWorkSize);
|
2017-12-21 00:45:38 +01:00
|
|
|
auto pDest = indirectHeap.getSpace(sizePerThreadDataTotal);
|
|
|
|
|
|
|
|
|
|
// Generate local IDs
|
|
|
|
|
DEBUG_BREAK_IF(numChannels != 3);
|
2020-11-04 10:34:42 +01:00
|
|
|
generateLocalIDs(pDest, static_cast<uint16_t>(simd), localWorkSizes, workgroupWalkOrder, hasKernelOnlyImages, grfSize);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
return offsetPerThreadData;
|
|
|
|
|
}
|
|
|
|
|
|
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 10:14:23 +01:00
|
|
|
uint32_t PerThreadDataHelper::getThreadPayloadSize(const KernelDescriptor &kernelDescriptor, uint32_t grfSize) {
|
|
|
|
|
uint32_t multiplier = static_cast<uint32_t>(getGRFsPerThread(kernelDescriptor.kernelAttributes.simdSize, grfSize));
|
2017-12-21 00:45:38 +01:00
|
|
|
uint32_t threadPayloadSize = 0;
|
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 10:14:23 +01:00
|
|
|
threadPayloadSize = kernelDescriptor.kernelAttributes.numLocalIdChannels * multiplier * grfSize;
|
|
|
|
|
threadPayloadSize += (kernelDescriptor.kernelAttributes.flags.perThreadDataHeaderIsPresent) ? grfSize : 0;
|
|
|
|
|
threadPayloadSize += (kernelDescriptor.kernelAttributes.flags.usesFlattenedLocalIds) ? (grfSize * multiplier) : 0;
|
|
|
|
|
threadPayloadSize += (kernelDescriptor.kernelAttributes.flags.perThreadDataUnusedGrfIsPresent) ? grfSize : 0;
|
2017-12-21 00:45:38 +01:00
|
|
|
return threadPayloadSize;
|
|
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|