2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2025-02-18 22:35:36 +08:00
|
|
|
* Copyright (C) 2018-2025 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
|
2025-02-18 22:35:36 +08:00
|
|
|
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
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"
|
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 {
|
2023-01-02 17:56:45 +08:00
|
|
|
struct HardwareInfo;
|
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
|
|
|
|
2023-11-24 01:09:04 +08:00
|
|
|
static const float yTilingRatioValue = 1.3862943611198906188344642429164f;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2025-02-18 22:35:36 +08:00
|
|
|
struct KernelInfo : NEO::NonCopyableAndNonMovableClass {
|
2017-12-21 07:45:38 +08:00
|
|
|
public:
|
2019-10-28 02:48:26 +08:00
|
|
|
KernelInfo() = default;
|
2017-12-21 07:45:38 +08:00
|
|
|
~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 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];
|
2023-10-05 22:56:27 +08:00
|
|
|
size_t maxRequiredWorkGroupSize = static_cast<size_t>(requiredWorkGroupSizeX) * requiredWorkGroupSizeY * requiredWorkGroupSizeZ;
|
2017-12-21 07:45:38 +08:00
|
|
|
if ((maxRequiredWorkGroupSize == 0) || (maxRequiredWorkGroupSize > maxWorkGroupSize)) {
|
|
|
|
maxRequiredWorkGroupSize = maxWorkGroupSize;
|
|
|
|
}
|
|
|
|
return maxRequiredWorkGroupSize;
|
|
|
|
}
|
|
|
|
|
2022-12-21 22:09:51 +08:00
|
|
|
bool isVmeUsed() const {
|
|
|
|
return kernelDescriptor.kernelAttributes.flags.usesVme;
|
|
|
|
}
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
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
|
|
|
|
2025-02-18 22:35:36 +08:00
|
|
|
static_assert(NEO::NonCopyableAndNonMovable<KernelInfo>);
|
|
|
|
|
2020-01-12 01:25:26 +08:00
|
|
|
std::string concatenateKernelNames(ArrayRef<KernelInfo *> kernelInfos);
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|