feature: Adding support for parsing sip_surface_offset
Adding support for parsing sip_surface_offset in accordance with zeinfo specification. This field is not used because surface offset calculations are dynamic and zebin binary can rely only on sip_surface_bti entry. However, failing to parse this unused entry blocks NEO from moving to stricter zebin validation. Related-To: NEO-11762 Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
parent
5ab81cb3bb
commit
e11ceb4a20
|
@ -81,6 +81,7 @@ inline constexpr ConstStringRef hintSuffix("_hint");
|
|||
|
||||
namespace DebugEnv {
|
||||
inline constexpr ConstStringRef debugSurfaceBTI("sip_surface_bti");
|
||||
inline constexpr ConstStringRef debugSurfaceOffset("sip_surface_offset");
|
||||
} // namespace DebugEnv
|
||||
|
||||
namespace PayloadArgument {
|
||||
|
@ -452,13 +453,16 @@ struct AttributesBaseT {
|
|||
|
||||
namespace DebugEnv {
|
||||
using DebugSurfaceBTIT = int32_t;
|
||||
using DebugSurfaceOffset = int32_t;
|
||||
|
||||
namespace Defaults {
|
||||
inline constexpr DebugSurfaceBTIT debugSurfaceBTI = -1;
|
||||
inline constexpr DebugSurfaceOffset debugSurfaceOffset = -1;
|
||||
} // namespace Defaults
|
||||
|
||||
struct DebugEnvBaseT {
|
||||
DebugSurfaceBTIT debugSurfaceBTI = Defaults::debugSurfaceBTI;
|
||||
DebugSurfaceOffset debugSurfaceOffset = Defaults::debugSurfaceOffset;
|
||||
};
|
||||
} // namespace DebugEnv
|
||||
|
||||
|
|
|
@ -821,6 +821,8 @@ DecodeError readZeInfoDebugEnvironment(const Yaml::YamlParser &parser, const Yam
|
|||
auto key = parser.readKey(debugEnvNd);
|
||||
if (Tags::Kernel::DebugEnv::debugSurfaceBTI == key) {
|
||||
validDebugEnv &= readZeInfoValueChecked(parser, debugEnvNd, outDebugEnv.debugSurfaceBTI, context, outErrReason);
|
||||
} else if (Tags::Kernel::DebugEnv::debugSurfaceOffset == key) {
|
||||
validDebugEnv &= readZeInfoValueChecked(parser, debugEnvNd, outDebugEnv.debugSurfaceOffset, context, outErrReason);
|
||||
} else {
|
||||
outWarning.append("DeviceBinaryFormat::zebin::.ze_info : Unknown entry \"" + key.str() + "\" in context of " + context.str() + "\n");
|
||||
}
|
||||
|
|
|
@ -2068,7 +2068,7 @@ kernels:
|
|||
EXPECT_TRUE(equals(attributes.invalidKernel.value(), "invalid_kernel_reason"));
|
||||
}
|
||||
|
||||
TEST(ReadZeInfoDebugEnvironment, givenValidYamlEntryThenSetProperMembers) {
|
||||
TEST(ReadZeInfoDebugEnvironment, givenSipSurfaceBtiEntryThenSetProperMembers) {
|
||||
NEO::ConstStringRef yaml = R"===(---
|
||||
kernels:
|
||||
- name: some_kernel
|
||||
|
@ -2094,6 +2094,32 @@ kernels:
|
|||
EXPECT_EQ(0, debugEnv.debugSurfaceBTI);
|
||||
}
|
||||
|
||||
TEST(ReadZeInfoDebugEnvironment, givenSipSurfaceOffsetEntryThenSetProperMembers) {
|
||||
NEO::ConstStringRef yaml = R"===(---
|
||||
kernels:
|
||||
- name: some_kernel
|
||||
debug_env:
|
||||
sip_surface_offset: 0
|
||||
...
|
||||
)===";
|
||||
|
||||
std::string parserErrors;
|
||||
std::string parserWarnings;
|
||||
NEO::Yaml::YamlParser parser;
|
||||
bool success = parser.parse(yaml, parserErrors, parserWarnings);
|
||||
ASSERT_TRUE(success);
|
||||
auto &argsNode = *parser.findNodeWithKeyDfs("debug_env");
|
||||
std::string errors;
|
||||
std::string warnings;
|
||||
NEO::Zebin::ZeInfo::Types::Kernel::DebugEnv::DebugEnvBaseT debugEnv;
|
||||
auto err = NEO::Zebin::ZeInfo::readZeInfoDebugEnvironment(parser, argsNode, debugEnv, "some_kernel", errors, warnings);
|
||||
EXPECT_EQ(NEO::DecodeError::success, err);
|
||||
EXPECT_TRUE(errors.empty()) << errors;
|
||||
EXPECT_TRUE(warnings.empty()) << warnings;
|
||||
|
||||
EXPECT_EQ(0, debugEnv.debugSurfaceOffset);
|
||||
}
|
||||
|
||||
TEST(ReadZeInfoDebugEnvironment, givenUnknownEntryThenEmitsWarning) {
|
||||
NEO::ConstStringRef yaml = R"===(---
|
||||
kernels:
|
||||
|
|
Loading…
Reference in New Issue