2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2022-01-19 00:57:12 +08:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-25 05:07:46 +08:00
|
|
|
#include "shared/source/kernel/kernel_descriptor.h"
|
2021-09-16 18:33:44 +08:00
|
|
|
#include "shared/source/program/heap_info.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/utilities/arrayref.h"
|
2022-05-18 03:04:23 +08:00
|
|
|
#include "shared/source/utilities/stackvec.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <cstdint>
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <string>
|
2022-05-18 03:04:23 +08:00
|
|
|
#include <utility>
|
2018-08-06 17:35:59 +08:00
|
|
|
#include <vector>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-01-12 01:25:26 +08:00
|
|
|
namespace gtpin {
|
|
|
|
typedef struct igc_info_s igc_info_t;
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
class BuiltinDispatchInfoBuilder;
|
|
|
|
class Device;
|
|
|
|
class Kernel;
|
|
|
|
struct KernelInfo;
|
2018-02-02 17:33:31 +08:00
|
|
|
class DispatchInfo;
|
2017-12-21 07:45:38 +08:00
|
|
|
struct KernelArgumentType;
|
2018-03-08 18:56:44 +08:00
|
|
|
class GraphicsAllocation;
|
2018-04-05 01:02:07 +08:00
|
|
|
class MemoryManager;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
static const float YTilingRatioValue = 1.3862943611198906188344642429164f;
|
|
|
|
|
|
|
|
struct WorkSizeInfo {
|
|
|
|
uint32_t maxWorkGroupSize;
|
|
|
|
uint32_t minWorkGroupSize;
|
2018-01-16 17:37:26 +08:00
|
|
|
bool hasBarriers;
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t simdSize;
|
|
|
|
uint32_t slmTotalSize;
|
|
|
|
GFXCORE_FAMILY coreFamily;
|
2018-01-16 17:37:26 +08:00
|
|
|
uint32_t numThreadsPerSubSlice;
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t localMemSize;
|
|
|
|
bool imgUsed = false;
|
|
|
|
bool yTiledSurfaces = false;
|
|
|
|
bool useRatio = false;
|
|
|
|
bool useStrictRatio = false;
|
|
|
|
float targetRatio = 0;
|
|
|
|
|
2022-02-11 07:33:40 +08:00
|
|
|
WorkSizeInfo(uint32_t maxWorkGroupSize, bool hasBarriers, uint32_t simdSize, uint32_t slmTotalSize, const HardwareInfo *hwInfo, uint32_t numThreadsPerSubSlice, uint32_t localMemSize, bool imgUsed, bool yTiledSurface, bool disableEUFusion);
|
2021-09-30 03:10:53 +08:00
|
|
|
|
2020-12-08 20:11:40 +08:00
|
|
|
void setIfUseImg(const KernelInfo &kernelInfo);
|
2022-02-11 07:33:40 +08:00
|
|
|
void setMinWorkGroupSize(const HardwareInfo *hwInfo, bool disableEUFusion);
|
2017-12-21 07:45:38 +08:00
|
|
|
void checkRatio(const size_t workItems[3]);
|
|
|
|
};
|
|
|
|
|
2020-01-12 01:25:26 +08:00
|
|
|
struct DeviceInfoKernelPayloadConstants {
|
|
|
|
void *slmWindow = nullptr;
|
|
|
|
uint32_t slmWindowSize = 0U;
|
|
|
|
uint32_t computeUnitsUsedForScratch = 0U;
|
|
|
|
uint32_t maxWorkGroupSize = 0U;
|
|
|
|
};
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
struct KernelInfo {
|
|
|
|
public:
|
2019-10-28 02:48:26 +08:00
|
|
|
KernelInfo() = default;
|
2017-12-21 07:45:38 +08:00
|
|
|
KernelInfo(const KernelInfo &) = delete;
|
|
|
|
KernelInfo &operator=(const KernelInfo &) = delete;
|
|
|
|
~KernelInfo();
|
|
|
|
|
2018-03-08 18:56:44 +08:00
|
|
|
GraphicsAllocation *getGraphicsAllocation() const { return this->kernelAllocation; }
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-04-08 17:05:45 +08:00
|
|
|
const ArgDescriptor &getArgDescriptorAt(uint32_t index) const {
|
|
|
|
DEBUG_BREAK_IF(index >= kernelDescriptor.payloadMappings.explicitArgs.size());
|
|
|
|
return kernelDescriptor.payloadMappings.explicitArgs[index];
|
|
|
|
}
|
|
|
|
const StackVec<ArgDescriptor, 16> &getExplicitArgs() const {
|
|
|
|
return kernelDescriptor.payloadMappings.explicitArgs;
|
|
|
|
}
|
|
|
|
const ArgTypeMetadataExtended &getExtendedMetadata(uint32_t index) const {
|
|
|
|
DEBUG_BREAK_IF(index >= kernelDescriptor.explicitArgsExtendedMetadata.size());
|
|
|
|
return kernelDescriptor.explicitArgsExtendedMetadata[index];
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t getSamplerStateArrayCount() const;
|
|
|
|
size_t getSamplerStateArraySize(const HardwareInfo &hwInfo) const;
|
|
|
|
size_t getBorderColorOffset() const;
|
|
|
|
unsigned int getMaxSimdSize() const {
|
2020-11-19 19:30:44 +08:00
|
|
|
return kernelDescriptor.kernelAttributes.simdSize;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
bool requiresSubgroupIndependentForwardProgress() const {
|
2020-11-19 19:30:44 +08:00
|
|
|
return kernelDescriptor.kernelAttributes.flags.requiresSubgroupIndependentForwardProgress;
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
size_t getMaxRequiredWorkGroupSize(size_t maxWorkGroupSize) const {
|
2020-10-27 22:16:42 +08:00
|
|
|
auto requiredWorkGroupSizeX = kernelDescriptor.kernelAttributes.requiredWorkgroupSize[0];
|
|
|
|
auto requiredWorkGroupSizeY = kernelDescriptor.kernelAttributes.requiredWorkgroupSize[1];
|
|
|
|
auto requiredWorkGroupSizeZ = kernelDescriptor.kernelAttributes.requiredWorkgroupSize[2];
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t maxRequiredWorkGroupSize = requiredWorkGroupSizeX * requiredWorkGroupSizeY * requiredWorkGroupSizeZ;
|
|
|
|
if ((maxRequiredWorkGroupSize == 0) || (maxRequiredWorkGroupSize > maxWorkGroupSize)) {
|
|
|
|
maxRequiredWorkGroupSize = maxWorkGroupSize;
|
|
|
|
}
|
|
|
|
return maxRequiredWorkGroupSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t getConstantBufferSize() const;
|
2021-04-08 17:05:45 +08:00
|
|
|
int32_t getArgNumByName(const char *name) const;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2022-03-01 22:17:54 +08:00
|
|
|
bool createKernelAllocation(const Device &device, bool internalIsa);
|
2020-01-26 02:18:48 +08:00
|
|
|
void apply(const DeviceInfoKernelPayloadConstants &constants);
|
2018-04-05 01:02:07 +08:00
|
|
|
|
2019-10-28 02:48:26 +08:00
|
|
|
HeapInfo heapInfo = {};
|
2017-12-21 07:45:38 +08:00
|
|
|
std::vector<std::pair<uint32_t, uint32_t>> childrenKernelsIdOffset;
|
|
|
|
char *crossThreadData = nullptr;
|
|
|
|
const BuiltinDispatchInfoBuilder *builtinDispatchBuilder = nullptr;
|
|
|
|
uint32_t systemKernelOffset = 0;
|
2018-01-24 20:26:46 +08:00
|
|
|
uint64_t kernelId = 0;
|
2018-02-08 23:00:20 +08:00
|
|
|
bool isKernelHeapSubstituted = false;
|
2018-03-08 18:56:44 +08:00
|
|
|
GraphicsAllocation *kernelAllocation = nullptr;
|
2018-04-23 20:26:03 +08:00
|
|
|
DebugData debugData;
|
2018-09-21 20:06:35 +08:00
|
|
|
bool computeMode = false;
|
2018-11-23 17:32:56 +08:00
|
|
|
const gtpin::igc_info_t *igcInfoForGtpin = nullptr;
|
2020-02-25 21:52:40 +08:00
|
|
|
|
2020-05-26 15:36:04 +08:00
|
|
|
uint64_t shaderHashCode;
|
2020-02-25 21:52:40 +08:00
|
|
|
KernelDescriptor kernelDescriptor;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2020-01-12 01:25:26 +08:00
|
|
|
|
|
|
|
std::string concatenateKernelNames(ArrayRef<KernelInfo *> kernelInfos);
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|