mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
refactor: parse extra zebin params
Related-To: NEO-12591 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e7b3a40aa7
commit
ff80a02fcb
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2020-2023 Intel Corporation
|
||||
# Copyright (C) 2020-2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -42,3 +42,5 @@ set(NEO_DEVICE_BINARY_FORMAT
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zebin/zeinfo_enum_lookup.h
|
||||
)
|
||||
set_property(GLOBAL PROPERTY NEO_DEVICE_BINARY_FORMAT ${NEO_DEVICE_BINARY_FORMAT})
|
||||
|
||||
add_subdirectories()
|
||||
|
||||
14
shared/source/device_binary_format/zebin/CMakeLists.txt
Normal file
14
shared/source/device_binary_format/zebin/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(NEO_CORE_ZEINFO_EXTRA
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}zeinfo_extra.cpp
|
||||
)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY NEO_CORE_ZEINFO_EXTRA ${NEO_CORE_ZEINFO_EXTRA})
|
||||
|
||||
add_subdirectories()
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/device_binary_format/yaml/yaml_parser.h"
|
||||
#include "shared/source/utilities/const_stringref.h"
|
||||
|
||||
#include <array>
|
||||
@@ -349,6 +350,9 @@ using IndirectStatelessCountT = int32_t;
|
||||
using HasSampleT = bool;
|
||||
using PrivateSizeT = int32_t;
|
||||
using SpillSizeT = int32_t;
|
||||
using AdditionalSizeT = int32_t;
|
||||
using WalkOrderT = int32_t;
|
||||
using PartitionDimT = int32_t;
|
||||
|
||||
namespace Defaults {
|
||||
inline constexpr BarrierCountT barrierCount = 0;
|
||||
@@ -380,6 +384,9 @@ inline constexpr IndirectStatelessCountT indirectStatelessCount = 0;
|
||||
inline constexpr HasSampleT hasSample = false;
|
||||
inline constexpr PrivateSizeT privateSize = 0;
|
||||
inline constexpr SpillSizeT spillSize = 0;
|
||||
inline constexpr AdditionalSizeT additionalSize = -1;
|
||||
inline constexpr WalkOrderT walkOrder = -1;
|
||||
inline constexpr PartitionDimT partitionDim = -1;
|
||||
} // namespace Defaults
|
||||
|
||||
inline constexpr ConstStringRef required[] = {
|
||||
@@ -415,6 +422,9 @@ struct ExecutionEnvBaseT {
|
||||
HasSampleT hasSample = Defaults::hasSample;
|
||||
PrivateSizeT privateSize = Defaults::privateSize;
|
||||
SpillSizeT spillSize = Defaults::spillSize;
|
||||
AdditionalSizeT additionalSize = Defaults::additionalSize;
|
||||
WalkOrderT walkOrder = Defaults::walkOrder;
|
||||
PartitionDimT partitionDim = Defaults::partitionDim;
|
||||
};
|
||||
|
||||
struct ExperimentalPropertiesBaseT {
|
||||
|
||||
@@ -674,7 +674,7 @@ DecodeError readZeInfoExecutionEnvironment(const Yaml::YamlParser &parser, const
|
||||
} else if (Tags::Kernel::ExecutionEnv::spillSize == key) {
|
||||
validExecEnv &= readZeInfoValueChecked(parser, execEnvMetadataNd, outExecEnv.spillSize, context, outErrReason);
|
||||
} else {
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, err);
|
||||
readZeInfoValueCheckedExtra(parser, execEnvMetadataNd, outExecEnv, context, key, outErrReason, outWarning, validExecEnv, err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -717,6 +717,17 @@ void populateKernelExecutionEnvironment(KernelDescriptor &dst, const KernelExecu
|
||||
dst.kernelAttributes.workgroupWalkOrder[2] = static_cast<uint8_t>(execEnv.workgroupWalkOrderDimensions[2]);
|
||||
dst.kernelAttributes.hasIndirectStatelessAccess = (execEnv.indirectStatelessCount > 0);
|
||||
dst.kernelAttributes.numThreadsRequired = static_cast<uint32_t>(execEnv.euThreadCount);
|
||||
|
||||
if (execEnv.additionalSize != Types::Kernel::ExecutionEnv::Defaults::additionalSize) {
|
||||
dst.kernelAttributes.additionalSize = static_cast<uint32_t>(execEnv.additionalSize);
|
||||
}
|
||||
if (execEnv.walkOrder != Types::Kernel::ExecutionEnv::Defaults::walkOrder) {
|
||||
dst.kernelAttributes.walkOrder = EncodeParamsApiMappings::walkOrder[execEnv.walkOrder];
|
||||
}
|
||||
if (execEnv.partitionDim != Types::Kernel::ExecutionEnv::Defaults::partitionDim) {
|
||||
dst.kernelAttributes.partitionDim = EncodeParamsApiMappings::partitionDim[execEnv.partitionDim];
|
||||
}
|
||||
|
||||
if (isScratchMemoryUsageDefinedInExecutionEnvironment(srcZeInfoVersion)) {
|
||||
dst.kernelAttributes.privateScratchMemorySize = static_cast<uint32_t>(execEnv.privateSize);
|
||||
dst.kernelAttributes.spillFillScratchMemorySize = static_cast<uint32_t>(execEnv.spillSize);
|
||||
|
||||
@@ -19,10 +19,16 @@ struct ProgramInfo;
|
||||
namespace Zebin::ZeInfo {
|
||||
inline constexpr NEO::Zebin::ZeInfo::Types::Version zeInfoDecoderVersion{1, 39};
|
||||
|
||||
using KernelExecutionEnvBaseT = Types::Kernel::ExecutionEnv::ExecutionEnvBaseT;
|
||||
|
||||
template <typename T>
|
||||
bool readZeInfoValueChecked(const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, T &outValue, ConstStringRef context, std::string &outErrReason);
|
||||
template <typename T>
|
||||
bool readEnumChecked(ConstStringRef enumString, T &outValue, ConstStringRef kernelName, std::string &outErrReason);
|
||||
template <typename T>
|
||||
bool readZeInfoEnumChecked(const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &node, T &outValue, ConstStringRef kernelName, std::string &outErrReason);
|
||||
void readZeInfoValueCheckedExtra(const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &execEnvMetadataNd, KernelExecutionEnvBaseT &kernelExecEnv, ConstStringRef context,
|
||||
ConstStringRef key, std::string &outErrReason, std::string &outWarning, bool &validExecEnv, DecodeError &error);
|
||||
|
||||
using UniqueNode = StackVec<const NEO::Yaml::Node *, 1>;
|
||||
struct ZeInfoSections {
|
||||
@@ -74,7 +80,6 @@ DecodeError decodeZeInfoFunctions(ProgramInfo &dst, Yaml::YamlParser &parser, co
|
||||
DecodeError decodeZeInfoKernels(ProgramInfo &dst, Yaml::YamlParser &parser, const ZeInfoSections &zeInfoSections, std::string &outErrReason, std::string &outWarning, const Types::Version &srcZeInfoVersion);
|
||||
DecodeError decodeZeInfoKernelEntry(KernelDescriptor &dst, Yaml::YamlParser &yamlParser, const Yaml::Node &kernelNd, uint32_t grfSize, uint32_t minScratchSpaceSize, std::string &outErrReason, std::string &outWarning, const Types::Version &srcZeInfoVersion);
|
||||
|
||||
using KernelExecutionEnvBaseT = Types::Kernel::ExecutionEnv::ExecutionEnvBaseT;
|
||||
DecodeError decodeZeInfoKernelExecutionEnvironment(KernelDescriptor &dst, Yaml::YamlParser &parser, const ZeInfoKernelSections &kernelSections, std::string &outErrReason, std::string &outWarning, const Types::Version &srcZeInfoVersion);
|
||||
DecodeError readZeInfoExecutionEnvironment(const Yaml::YamlParser &parser, const Yaml::Node &node, KernelExecutionEnvBaseT &outExecEnv, ConstStringRef context, std::string &outErrReason, std::string &outWarning);
|
||||
void populateKernelExecutionEnvironment(KernelDescriptor &dst, const KernelExecutionEnvBaseT &execEnv, const Types::Version &srcZeInfoVersion);
|
||||
|
||||
16
shared/source/device_binary_format/zebin/zeinfo_extra.cpp
Normal file
16
shared/source/device_binary_format/zebin/zeinfo_extra.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/device_binary_format/zebin/zeinfo_decoder.h"
|
||||
|
||||
namespace NEO::Zebin::ZeInfo {
|
||||
void readZeInfoValueCheckedExtra(const NEO::Yaml::YamlParser &parser, const NEO::Yaml::Node &execEnvMetadataNd, KernelExecutionEnvBaseT &kernelExecEnv, ConstStringRef context,
|
||||
ConstStringRef key, std::string &outErrReason, std::string &outWarning, bool &validExecEnv, DecodeError &error) {
|
||||
|
||||
encounterUnknownZeInfoAttribute("\"" + key.str() + "\" in context of " + context.str(), outErrReason, outWarning, error);
|
||||
}
|
||||
} // namespace NEO::Zebin::ZeInfo
|
||||
Reference in New Issue
Block a user