mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 05:56:36 +08:00
Refactor: pass gfxCoreHelper to decodeSingleDeviceBinary
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1dc4afe8ab
commit
234573399d
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -348,7 +348,8 @@ ze_result_t ModuleTranslationUnit::processUnpackedBinary() {
|
|||||||
|
|
||||||
NEO::DecodeError decodeError;
|
NEO::DecodeError decodeError;
|
||||||
NEO::DeviceBinaryFormat singleDeviceBinaryFormat;
|
NEO::DeviceBinaryFormat singleDeviceBinaryFormat;
|
||||||
std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, binary, decodeErrors, decodeWarnings);
|
auto &gfxCoreHelper = device->getGfxCoreHelper();
|
||||||
|
std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, binary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
if (decodeWarnings.empty() == false) {
|
if (decodeWarnings.empty() == false) {
|
||||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str());
|
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -213,7 +213,8 @@ cl_int Program::processGenBinary(const ClDevice &clDevice) {
|
|||||||
|
|
||||||
DecodeError decodeError;
|
DecodeError decodeError;
|
||||||
DeviceBinaryFormat singleDeviceBinaryFormat;
|
DeviceBinaryFormat singleDeviceBinaryFormat;
|
||||||
std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, binary, decodeErrors, decodeWarnings);
|
auto &gfxCoreHelper = clDevice.getGfxCoreHelper();
|
||||||
|
std::tie(decodeError, singleDeviceBinaryFormat) = NEO::decodeSingleDeviceBinary(programInfo, binary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
|
|
||||||
if (decodeWarnings.empty() == false) {
|
if (decodeWarnings.empty() == false) {
|
||||||
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str());
|
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s\n", decodeWarnings.c_str());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -87,7 +87,7 @@ SingleDeviceBinary unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(co
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning) {
|
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Archive>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning, const GfxCoreHelper &gfxCoreHelper) {
|
||||||
// packed binary format
|
// packed binary format
|
||||||
outErrReason = "Device binary format is packed";
|
outErrReason = "Device binary format is packed";
|
||||||
return DecodeError::InvalidBinary;
|
return DecodeError::InvalidBinary;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -111,7 +111,7 @@ SingleDeviceBinary unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::OclElf>(con
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::OclElf>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning) {
|
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::OclElf>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning, const GfxCoreHelper &gfxCoreHelper) {
|
||||||
// packed binary format
|
// packed binary format
|
||||||
outErrReason = "Device binary format is packed";
|
outErrReason = "Device binary format is packed";
|
||||||
return DecodeError::InvalidBinary;
|
return DecodeError::InvalidBinary;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -47,7 +47,7 @@ SingleDeviceBinary unpackSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning) {
|
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning, const GfxCoreHelper &gfxCoreHelper) {
|
||||||
NEO::PatchTokenBinary::ProgramFromPatchtokens decodedProgram = {};
|
NEO::PatchTokenBinary::ProgramFromPatchtokens decodedProgram = {};
|
||||||
NEO::PatchTokenBinary::decodeProgramFromPatchtokensBlob(src.deviceBinary, decodedProgram);
|
NEO::PatchTokenBinary::decodeProgramFromPatchtokensBlob(src.deviceBinary, decodedProgram);
|
||||||
DBG_LOG(LogPatchTokens, NEO::PatchTokenBinary::asString(decodedProgram).c_str());
|
DBG_LOG(LogPatchTokens, NEO::PatchTokenBinary::asString(decodedProgram).c_str());
|
||||||
@@ -62,8 +62,7 @@ DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(Progr
|
|||||||
NEO::populateProgramInfo(dst, decodedProgram);
|
NEO::populateProgramInfo(dst, decodedProgram);
|
||||||
|
|
||||||
// set barrierCount to number of barriers decoded from hasBarriers token
|
// set barrierCount to number of barriers decoded from hasBarriers token
|
||||||
UNRECOVERABLE_IF(src.targetDevice.coreFamily == IGFX_UNKNOWN_CORE);
|
|
||||||
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(src.targetDevice.coreFamily);
|
|
||||||
for (auto &ki : dst.kernelInfos) {
|
for (auto &ki : dst.kernelInfos) {
|
||||||
auto &kd = ki->kernelDescriptor;
|
auto &kd = ki->kernelDescriptor;
|
||||||
kd.kernelAttributes.barrierCount = gfxCoreHelper.getBarriersCountFromHasBarriers(kd.kernelAttributes.barrierCount);
|
kd.kernelAttributes.barrierCount = gfxCoreHelper.getBarriersCountFromHasBarriers(kd.kernelAttributes.barrierCount);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -115,7 +115,7 @@ DecodeError decodeSingleZebin(ProgramInfo &dst, const SingleDeviceBinary &src, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning) {
|
DecodeError decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning, const GfxCoreHelper &gfxCoreHelper) {
|
||||||
return Elf::isElf<Elf::EI_CLASS_32>(src.deviceBinary)
|
return Elf::isElf<Elf::EI_CLASS_32>(src.deviceBinary)
|
||||||
? decodeSingleZebin<Elf::EI_CLASS_32>(dst, src, outErrReason, outWarning)
|
? decodeSingleZebin<Elf::EI_CLASS_32>(dst, src, outErrReason, outWarning)
|
||||||
: decodeSingleZebin<Elf::EI_CLASS_64>(dst, src, outErrReason, outWarning);
|
: decodeSingleZebin<Elf::EI_CLASS_64>(dst, src, outErrReason, outWarning);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
namespace NEO {
|
namespace NEO {
|
||||||
struct ProgramInfo;
|
struct ProgramInfo;
|
||||||
struct RootDeviceEnvironment;
|
struct RootDeviceEnvironment;
|
||||||
|
class GfxCoreHelper;
|
||||||
|
|
||||||
enum class DeviceBinaryFormat : uint8_t {
|
enum class DeviceBinaryFormat : uint8_t {
|
||||||
Unknown,
|
Unknown,
|
||||||
@@ -160,33 +161,33 @@ inline bool isAnySingleDeviceBinaryFormat(const ArrayRef<const uint8_t> binary)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <DeviceBinaryFormat Format>
|
template <DeviceBinaryFormat Format>
|
||||||
DecodeError decodeSingleDeviceBinary(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning);
|
DecodeError decodeSingleDeviceBinary(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning, const GfxCoreHelper &gfxCoreHelper);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::OclElf>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &);
|
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::OclElf>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &, const GfxCoreHelper &gfxCoreHelper);
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::Patchtokens>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &);
|
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::Patchtokens>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &, const GfxCoreHelper &gfxCoreHelper);
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::Archive>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &);
|
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::Archive>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &, const GfxCoreHelper &gfxCoreHelper);
|
||||||
template <>
|
template <>
|
||||||
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::Zebin>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &);
|
DecodeError decodeSingleDeviceBinary<DeviceBinaryFormat::Zebin>(ProgramInfo &, const SingleDeviceBinary &, std::string &, std::string &, const GfxCoreHelper &gfxCoreHelper);
|
||||||
|
|
||||||
inline std::pair<DecodeError, DeviceBinaryFormat> decodeSingleDeviceBinary(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning) {
|
inline std::pair<DecodeError, DeviceBinaryFormat> decodeSingleDeviceBinary(ProgramInfo &dst, const SingleDeviceBinary &src, std::string &outErrReason, std::string &outWarning, const GfxCoreHelper &gfxCoreHelper) {
|
||||||
std::pair<DecodeError, DeviceBinaryFormat> ret;
|
std::pair<DecodeError, DeviceBinaryFormat> ret;
|
||||||
ret.first = DecodeError::InvalidBinary;
|
ret.first = DecodeError::InvalidBinary;
|
||||||
ret.second = DeviceBinaryFormat::Unknown;
|
ret.second = DeviceBinaryFormat::Unknown;
|
||||||
if (isDeviceBinaryFormat<DeviceBinaryFormat::OclElf>(src.deviceBinary)) {
|
if (isDeviceBinaryFormat<DeviceBinaryFormat::OclElf>(src.deviceBinary)) {
|
||||||
ret.second = DeviceBinaryFormat::OclElf;
|
ret.second = DeviceBinaryFormat::OclElf;
|
||||||
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::OclElf>(dst, src, outErrReason, outWarning);
|
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::OclElf>(dst, src, outErrReason, outWarning, gfxCoreHelper);
|
||||||
} else if (isDeviceBinaryFormat<DeviceBinaryFormat::Patchtokens>(src.deviceBinary)) {
|
} else if (isDeviceBinaryFormat<DeviceBinaryFormat::Patchtokens>(src.deviceBinary)) {
|
||||||
ret.second = DeviceBinaryFormat::Patchtokens;
|
ret.second = DeviceBinaryFormat::Patchtokens;
|
||||||
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::Patchtokens>(dst, src, outErrReason, outWarning);
|
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::Patchtokens>(dst, src, outErrReason, outWarning, gfxCoreHelper);
|
||||||
} else if (isDeviceBinaryFormat<DeviceBinaryFormat::Archive>(src.deviceBinary)) {
|
} else if (isDeviceBinaryFormat<DeviceBinaryFormat::Archive>(src.deviceBinary)) {
|
||||||
ret.second = DeviceBinaryFormat::Archive;
|
ret.second = DeviceBinaryFormat::Archive;
|
||||||
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::Archive>(dst, src, outErrReason, outWarning);
|
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::Archive>(dst, src, outErrReason, outWarning, gfxCoreHelper);
|
||||||
} else if (isDeviceBinaryFormat<DeviceBinaryFormat::Zebin>(src.deviceBinary)) {
|
} else if (isDeviceBinaryFormat<DeviceBinaryFormat::Zebin>(src.deviceBinary)) {
|
||||||
ret.second = DeviceBinaryFormat::Zebin;
|
ret.second = DeviceBinaryFormat::Zebin;
|
||||||
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::Zebin>(dst, src, outErrReason, outWarning);
|
ret.first = decodeSingleDeviceBinary<DeviceBinaryFormat::Zebin>(dst, src, outErrReason, outWarning, gfxCoreHelper);
|
||||||
} else {
|
} else {
|
||||||
outErrReason = "Unknown format";
|
outErrReason = "Unknown format";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||||
#include "shared/source/program/program_info.h"
|
#include "shared/source/program/program_info.h"
|
||||||
#include "shared/test/common/device_binary_format/patchtokens_tests.h"
|
#include "shared/test/common/device_binary_format/patchtokens_tests.h"
|
||||||
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||||
#include "shared/test/common/test_macros/test.h"
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -213,6 +214,8 @@ TEST(UnpackSingleDeviceBinaryOclElf, GivenOclElfExecutableWhenPatchtokensBinaryI
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryOclElf, WhenUsedAsSingleDeviceBinaryThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinaryOclElf, WhenUsedAsSingleDeviceBinaryThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
PatchTokensTestData::ValidEmptyProgram patchtokensProgram;
|
PatchTokensTestData::ValidEmptyProgram patchtokensProgram;
|
||||||
|
|
||||||
NEO::Elf::ElfEncoder<NEO::Elf::EI_CLASS_64> elfEnc64;
|
NEO::Elf::ElfEncoder<NEO::Elf::EI_CLASS_64> elfEnc64;
|
||||||
@@ -232,7 +235,7 @@ TEST(DecodeSingleDeviceBinaryOclElf, WhenUsedAsSingleDeviceBinaryThenDecodingFai
|
|||||||
std::string unpackErrors;
|
std::string unpackErrors;
|
||||||
std::string unpackWarnings;
|
std::string unpackWarnings;
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
NEO::DecodeError error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::OclElf>(programInfo, deviceBinary, unpackErrors, unpackWarnings);
|
NEO::DecodeError error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::OclElf>(programInfo, deviceBinary, unpackErrors, unpackWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_TRUE(unpackWarnings.empty());
|
EXPECT_TRUE(unpackWarnings.empty());
|
||||||
EXPECT_FALSE(unpackErrors.empty());
|
EXPECT_FALSE(unpackErrors.empty());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "shared/source/device_binary_format/device_binary_formats.h"
|
#include "shared/source/device_binary_format/device_binary_formats.h"
|
||||||
#include "shared/source/program/program_info.h"
|
#include "shared/source/program/program_info.h"
|
||||||
#include "shared/test/common/device_binary_format/patchtokens_tests.h"
|
#include "shared/test/common/device_binary_format/patchtokens_tests.h"
|
||||||
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||||
#include "shared/test/common/test_macros/test.h"
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
|
||||||
TEST(IsDeviceBinaryFormatPatchtokens, GivenValidBinaryThenReturnTrue) {
|
TEST(IsDeviceBinaryFormatPatchtokens, GivenValidBinaryThenReturnTrue) {
|
||||||
@@ -129,11 +130,13 @@ TEST(UnpackSingleDeviceBinaryPatchtokens, WhenValidBinaryWithUnsupportedPointerS
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryPatchtokens, GivenInvalidBinaryThenReturnError) {
|
TEST(DecodeSingleDeviceBinaryPatchtokens, GivenInvalidBinaryThenReturnError) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
NEO::SingleDeviceBinary singleBinary;
|
NEO::SingleDeviceBinary singleBinary;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
EXPECT_FALSE(decodeErrors.empty());
|
EXPECT_FALSE(decodeErrors.empty());
|
||||||
@@ -141,6 +144,8 @@ TEST(DecodeSingleDeviceBinaryPatchtokens, GivenInvalidBinaryThenReturnError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryPatchtokens, GivenValidBinaryThenOutputIsProperlyPopulated) {
|
TEST(DecodeSingleDeviceBinaryPatchtokens, GivenValidBinaryThenOutputIsProperlyPopulated) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
PatchTokensTestData::ValidProgramWithKernel programTokens;
|
PatchTokensTestData::ValidProgramWithKernel programTokens;
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
NEO::SingleDeviceBinary singleBinary;
|
NEO::SingleDeviceBinary singleBinary;
|
||||||
@@ -148,7 +153,7 @@ TEST(DecodeSingleDeviceBinaryPatchtokens, GivenValidBinaryThenOutputIsProperlyPo
|
|||||||
singleBinary.targetDevice.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
singleBinary.targetDevice.coreFamily = static_cast<GFXCORE_FAMILY>(programTokens.header->Device);
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Patchtokens>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
EXPECT_TRUE(decodeErrors.empty());
|
EXPECT_TRUE(decodeErrors.empty());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
#include "shared/source/device_binary_format/elf/ocl_elf.h"
|
||||||
#include "shared/source/program/program_info.h"
|
#include "shared/source/program/program_info.h"
|
||||||
#include "shared/test/common/device_binary_format/patchtokens_tests.h"
|
#include "shared/test/common/device_binary_format/patchtokens_tests.h"
|
||||||
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||||
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
||||||
#include "shared/test/common/test_macros/test.h"
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
|
||||||
@@ -238,6 +239,8 @@ TEST(IsAnySingleDeviceBinaryFormat, GivenZebinFormatThenReturnsTrue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinary, GivenUnknownFormatThenReturnFalse) {
|
TEST(DecodeSingleDeviceBinary, GivenUnknownFormatThenReturnFalse) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
const uint8_t data[] = "none of known formats";
|
const uint8_t data[] = "none of known formats";
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
@@ -246,7 +249,7 @@ TEST(DecodeSingleDeviceBinary, GivenUnknownFormatThenReturnFalse) {
|
|||||||
bin.deviceBinary = data;
|
bin.deviceBinary = data;
|
||||||
NEO::DecodeError status;
|
NEO::DecodeError status;
|
||||||
NEO::DeviceBinaryFormat format;
|
NEO::DeviceBinaryFormat format;
|
||||||
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings);
|
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, status);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, status);
|
||||||
EXPECT_EQ(NEO::DeviceBinaryFormat::Unknown, format);
|
EXPECT_EQ(NEO::DeviceBinaryFormat::Unknown, format);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
@@ -254,6 +257,8 @@ TEST(DecodeSingleDeviceBinary, GivenUnknownFormatThenReturnFalse) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinary, GivenPatchTokensFormatThenDecodingSucceeds) {
|
TEST(DecodeSingleDeviceBinary, GivenPatchTokensFormatThenDecodingSucceeds) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
PatchTokensTestData::ValidEmptyProgram patchtokensProgram;
|
PatchTokensTestData::ValidEmptyProgram patchtokensProgram;
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
@@ -263,7 +268,7 @@ TEST(DecodeSingleDeviceBinary, GivenPatchTokensFormatThenDecodingSucceeds) {
|
|||||||
bin.targetDevice.coreFamily = static_cast<GFXCORE_FAMILY>(patchtokensProgram.header->Device);
|
bin.targetDevice.coreFamily = static_cast<GFXCORE_FAMILY>(patchtokensProgram.header->Device);
|
||||||
NEO::DecodeError status;
|
NEO::DecodeError status;
|
||||||
NEO::DeviceBinaryFormat format;
|
NEO::DeviceBinaryFormat format;
|
||||||
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings);
|
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, status);
|
EXPECT_EQ(NEO::DecodeError::Success, status);
|
||||||
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, format);
|
EXPECT_EQ(NEO::DeviceBinaryFormat::Patchtokens, format);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
@@ -271,6 +276,8 @@ TEST(DecodeSingleDeviceBinary, GivenPatchTokensFormatThenDecodingSucceeds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinary, GivenZebinFormatThenDecodingSucceeds) {
|
TEST(DecodeSingleDeviceBinary, GivenZebinFormatThenDecodingSucceeds) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebinElf;
|
ZebinTestData::ValidEmptyProgram zebinElf;
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
@@ -279,7 +286,7 @@ TEST(DecodeSingleDeviceBinary, GivenZebinFormatThenDecodingSucceeds) {
|
|||||||
bin.deviceBinary = zebinElf.storage;
|
bin.deviceBinary = zebinElf.storage;
|
||||||
NEO::DecodeError status;
|
NEO::DecodeError status;
|
||||||
NEO::DeviceBinaryFormat format;
|
NEO::DeviceBinaryFormat format;
|
||||||
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings);
|
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, status);
|
EXPECT_EQ(NEO::DecodeError::Success, status);
|
||||||
EXPECT_EQ(NEO::DeviceBinaryFormat::Zebin, format);
|
EXPECT_EQ(NEO::DeviceBinaryFormat::Zebin, format);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
@@ -287,6 +294,8 @@ TEST(DecodeSingleDeviceBinary, GivenZebinFormatThenDecodingSucceeds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinary, GivenZebinWithExternalFunctionsThenDecodingSucceedsAndLinkerInputIsSet) {
|
TEST(DecodeSingleDeviceBinary, GivenZebinWithExternalFunctionsThenDecodingSucceedsAndLinkerInputIsSet) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ZebinWithExternalFunctionsInfo zebinElf;
|
ZebinTestData::ZebinWithExternalFunctionsInfo zebinElf;
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
@@ -295,7 +304,7 @@ TEST(DecodeSingleDeviceBinary, GivenZebinWithExternalFunctionsThenDecodingSuccee
|
|||||||
bin.deviceBinary = zebinElf.storage;
|
bin.deviceBinary = zebinElf.storage;
|
||||||
NEO::DecodeError status;
|
NEO::DecodeError status;
|
||||||
NEO::DeviceBinaryFormat format;
|
NEO::DeviceBinaryFormat format;
|
||||||
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings);
|
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, status);
|
EXPECT_EQ(NEO::DecodeError::Success, status);
|
||||||
EXPECT_EQ(NEO::DeviceBinaryFormat::Zebin, format);
|
EXPECT_EQ(NEO::DeviceBinaryFormat::Zebin, format);
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
@@ -304,6 +313,8 @@ TEST(DecodeSingleDeviceBinary, GivenZebinWithExternalFunctionsThenDecodingSuccee
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinary, GivenOclElfFormatThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinary, GivenOclElfFormatThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
PatchTokensTestData::ValidEmptyProgram patchtokensProgram;
|
PatchTokensTestData::ValidEmptyProgram patchtokensProgram;
|
||||||
|
|
||||||
NEO::Elf::ElfEncoder<NEO::Elf::EI_CLASS_64> elfEnc;
|
NEO::Elf::ElfEncoder<NEO::Elf::EI_CLASS_64> elfEnc;
|
||||||
@@ -318,7 +329,7 @@ TEST(DecodeSingleDeviceBinary, GivenOclElfFormatThenDecodingFails) {
|
|||||||
bin.deviceBinary = elfData;
|
bin.deviceBinary = elfData;
|
||||||
NEO::DecodeError status;
|
NEO::DecodeError status;
|
||||||
NEO::DeviceBinaryFormat format;
|
NEO::DeviceBinaryFormat format;
|
||||||
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings);
|
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, status);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, status);
|
||||||
EXPECT_EQ(NEO::DeviceBinaryFormat::OclElf, format);
|
EXPECT_EQ(NEO::DeviceBinaryFormat::OclElf, format);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
@@ -326,6 +337,8 @@ TEST(DecodeSingleDeviceBinary, GivenOclElfFormatThenDecodingFails) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinary, GivenArFormatThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinary, GivenArFormatThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
NEO::Ar::ArEncoder arEnc;
|
NEO::Ar::ArEncoder arEnc;
|
||||||
auto arData = arEnc.encode();
|
auto arData = arEnc.encode();
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
@@ -335,7 +348,7 @@ TEST(DecodeSingleDeviceBinary, GivenArFormatThenDecodingFails) {
|
|||||||
bin.deviceBinary = arData;
|
bin.deviceBinary = arData;
|
||||||
NEO::DecodeError status;
|
NEO::DecodeError status;
|
||||||
NEO::DeviceBinaryFormat format;
|
NEO::DeviceBinaryFormat format;
|
||||||
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings);
|
std::tie(status, format) = NEO::decodeSingleDeviceBinary(programInfo, bin, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, status);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, status);
|
||||||
EXPECT_EQ(NEO::DeviceBinaryFormat::Archive, format);
|
EXPECT_EQ(NEO::DeviceBinaryFormat::Archive, format);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020-2022 Intel Corporation
|
* Copyright (C) 2020-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "shared/source/program/program_info.h"
|
#include "shared/source/program/program_info.h"
|
||||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||||
#include "shared/test/common/mocks/mock_elf.h"
|
#include "shared/test/common/mocks/mock_elf.h"
|
||||||
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||||
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
#include "shared/test/common/mocks/mock_modules_zebin.h"
|
||||||
#include "shared/test/common/test_macros/test.h"
|
#include "shared/test/common/test_macros/test.h"
|
||||||
|
|
||||||
@@ -2562,24 +2563,28 @@ kernels:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenValid32BitZebinThenReturnSuccess) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenValid32BitZebinThenReturnSuccess) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
NEO::SingleDeviceBinary singleBinary;
|
NEO::SingleDeviceBinary singleBinary;
|
||||||
ZebinTestData::ValidEmptyProgram<Elf::EI_CLASS_32> zebin;
|
ZebinTestData::ValidEmptyProgram<Elf::EI_CLASS_32> zebin;
|
||||||
singleBinary.deviceBinary = {zebin.storage.data(), zebin.storage.size()};
|
singleBinary.deviceBinary = {zebin.storage.data(), zebin.storage.size()};
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
EXPECT_TRUE(decodeErrors.empty());
|
EXPECT_TRUE(decodeErrors.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenInvalidElfThenReturnError) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenInvalidElfThenReturnError) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
NEO::ProgramInfo programInfo;
|
NEO::ProgramInfo programInfo;
|
||||||
NEO::SingleDeviceBinary singleBinary;
|
NEO::SingleDeviceBinary singleBinary;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
EXPECT_FALSE(decodeErrors.empty());
|
EXPECT_FALSE(decodeErrors.empty());
|
||||||
@@ -2587,6 +2592,8 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenInvalidElfThenReturnError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenFailedToExtractZebinSectionsThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenFailedToExtractZebinSectionsThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.elfHeader->shStrNdx = NEO::Elf::SHN_UNDEF;
|
zebin.elfHeader->shStrNdx = NEO::Elf::SHN_UNDEF;
|
||||||
|
|
||||||
@@ -2595,7 +2602,7 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenFailedToExtractZebinSectionsThenDecoding
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
EXPECT_FALSE(decodeErrors.empty());
|
EXPECT_FALSE(decodeErrors.empty());
|
||||||
@@ -2614,6 +2621,8 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenFailedToExtractZebinSectionsThenDecoding
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenValidationOfZebinSectionsCountFailsThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenValidationOfZebinSectionsCountFailsThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.appendSection(NEO::Elf::SHT_ZEBIN_SPIRV, NEO::Elf::SectionsNamesZebin::spv, {});
|
zebin.appendSection(NEO::Elf::SHT_ZEBIN_SPIRV, NEO::Elf::SectionsNamesZebin::spv, {});
|
||||||
zebin.appendSection(NEO::Elf::SHT_ZEBIN_SPIRV, NEO::Elf::SectionsNamesZebin::spv, {});
|
zebin.appendSection(NEO::Elf::SHT_ZEBIN_SPIRV, NEO::Elf::SectionsNamesZebin::spv, {});
|
||||||
@@ -2623,7 +2632,7 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenValidationOfZebinSectionsCountFailsThenD
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
EXPECT_FALSE(decodeErrors.empty());
|
EXPECT_FALSE(decodeErrors.empty());
|
||||||
@@ -2649,6 +2658,8 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenValidationOfZebinSectionsCountFailsThenD
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenGlobalDataSectionThenSetsUpInitDataAndSize) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenGlobalDataSectionThenSetsUpInitDataAndSize) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
||||||
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::dataGlobal, data);
|
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::dataGlobal, data);
|
||||||
@@ -2658,7 +2669,7 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenGlobalDataSectionThenSetsUpInitDataAndS
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
@@ -2669,6 +2680,8 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenGlobalDataSectionThenSetsUpInitDataAndS
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataSectionThenSetsUpInitDataAndSize) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataSectionThenSetsUpInitDataAndSize) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
||||||
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::dataConst, data);
|
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::dataConst, data);
|
||||||
@@ -2678,7 +2691,7 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataSectionThenSetsUpInitDataAndSi
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
@@ -2689,6 +2702,8 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataSectionThenSetsUpInitDataAndSi
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataStringsSectionThenSetsUpInitDataAndSize) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataStringsSectionThenSetsUpInitDataAndSize) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
const uint8_t data[] = {'H', 'e', 'l', 'l', 'o', '!'};
|
const uint8_t data[] = {'H', 'e', 'l', 'l', 'o', '!'};
|
||||||
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::dataConstString, data);
|
zebin.appendSection(NEO::Elf::SHT_PROGBITS, NEO::Elf::SectionsNamesZebin::dataConstString, data);
|
||||||
@@ -2698,7 +2713,7 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenConstDataStringsSectionThenSetsUpInitDa
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
@@ -2758,6 +2773,8 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenNoteSectionDifferentThanIntelGTThenEmit
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenSymtabSectionThenEmitsWarningAndSkipsIt) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenSymtabSectionThenEmitsWarningAndSkipsIt) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
||||||
zebin.appendSection(NEO::Elf::SHT_SYMTAB, NEO::Elf::SectionsNamesZebin::symtab, data).entsize = sizeof(NEO::Elf::ElfSymbolEntry<NEO::Elf::EI_CLASS_64>);
|
zebin.appendSection(NEO::Elf::SHT_SYMTAB, NEO::Elf::SectionsNamesZebin::symtab, data).entsize = sizeof(NEO::Elf::ElfSymbolEntry<NEO::Elf::EI_CLASS_64>);
|
||||||
@@ -2767,13 +2784,15 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenSymtabSectionThenEmitsWarningAndSkipsIt
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin : Ignoring symbol table\n", decodeWarnings.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin : Ignoring symbol table\n", decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenSymtabWithInvalidSymEntriesThenFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenSymtabWithInvalidSymEntriesThenFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
const uint8_t data[] = {2, 3, 5, 7, 11, 13, 17, 19};
|
||||||
zebin.appendSection(NEO::Elf::SHT_SYMTAB, NEO::Elf::SectionsNamesZebin::symtab, data).entsize = sizeof(NEO::Elf::ElfSymbolEntry<NEO::Elf::EI_CLASS_64>) - 1;
|
zebin.appendSection(NEO::Elf::SHT_SYMTAB, NEO::Elf::SectionsNamesZebin::symtab, data).entsize = sizeof(NEO::Elf::ElfSymbolEntry<NEO::Elf::EI_CLASS_64>) - 1;
|
||||||
@@ -2783,13 +2802,15 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenSymtabWithInvalidSymEntriesThenFails) {
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_STREQ("Invalid symbol table entries size - expected : 24, got : 23\n", decodeErrors.c_str());
|
EXPECT_STREQ("Invalid symbol table entries size - expected : 24, got : 23\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoSectionIsEmptyThenEmitsWarning) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoSectionIsEmptyThenEmitsWarning) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
|
|
||||||
@@ -2798,13 +2819,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoSectionIsEmptyThenEmitsWarning) {
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin : Expected at least one .ze_info section, got 0\n", decodeWarnings.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin : Expected at least one .ze_info section, got 0\n", decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenYamlParserForZeInfoFailsThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenYamlParserForZeInfoFailsThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto brokenZeInfo = NEO::ConstStringRef("unterminated_string : \"");
|
auto brokenZeInfo = NEO::ConstStringRef("unterminated_string : \"");
|
||||||
@@ -2815,7 +2838,7 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenYamlParserForZeInfoFailsThenDecodingFail
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
|
|
||||||
@@ -2829,6 +2852,8 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenYamlParserForZeInfoFailsThenDecodingFail
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenEmptyInZeInfoThenEmitsWarning) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenEmptyInZeInfoThenEmitsWarning) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto brokenZeInfo = NEO::ConstStringRef("#no data\n");
|
auto brokenZeInfo = NEO::ConstStringRef("#no data\n");
|
||||||
@@ -2839,13 +2864,15 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenEmptyInZeInfoThenEmitsWarning) {
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ("NEO::Yaml : Text has no data\nDeviceBinaryFormat::Zebin : Empty kernels metadata section (.ze_info)\n", decodeWarnings.c_str());
|
EXPECT_STREQ("NEO::Yaml : Text has no data\nDeviceBinaryFormat::Zebin : Empty kernels metadata section (.ze_info)\n", decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenUnknownEntryInZeInfoGlobalScopeThenEmitsWarning) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenUnknownEntryInZeInfoGlobalScopeThenEmitsWarning) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto brokenZeInfo = std::string("some_entry : a\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\nversion:\'") + versionToString(zeInfoDecoderVersion) + "\'\n";
|
auto brokenZeInfo = std::string("some_entry : a\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\nversion:\'") + versionToString(zeInfoDecoderVersion) + "\'\n";
|
||||||
@@ -2856,13 +2883,15 @@ TEST(DecodeSingleDeviceBinaryZebin, GivenUnknownEntryInZeInfoGlobalScopeThenEmit
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unknown entry \"some_entry\" in global scope of .ze_info\n", decodeWarnings.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unknown entry \"some_entry\" in global scope of .ze_info\n", decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainKernelsSectionThenEmitsWarning) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainKernelsSectionThenEmitsWarning) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto brokenZeInfo = std::string("version:\'") + versionToString(zeInfoDecoderVersion) + "\'\na:b\n";
|
auto brokenZeInfo = std::string("version:\'") + versionToString(zeInfoDecoderVersion) + "\'\na:b\n";
|
||||||
@@ -2873,13 +2902,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainKernelsSectionThenEm
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unknown entry \"a\" in global scope of .ze_info\nDeviceBinaryFormat::Zebin::.ze_info : Expected one kernels entry in global scope of .ze_info, got : 0\n", decodeWarnings.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unknown entry \"a\" in global scope of .ze_info\nDeviceBinaryFormat::Zebin::.ze_info : Expected one kernels entry in global scope of .ze_info, got : 0\n", decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleKernelSectionsThenFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleKernelSectionsThenFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto brokenZeInfo = std::string("version:\'") + versionToString(zeInfoDecoderVersion) + "\'\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\n" + "\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\n...\n";
|
auto brokenZeInfo = std::string("version:\'") + versionToString(zeInfoDecoderVersion) + "\'\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\n" + "\nkernels : \n - name : valid_empty_kernel\n execution_env : \n simd_size : 32\n grf_count : 128\n...\n";
|
||||||
@@ -2890,13 +2921,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleKernelSectionsThen
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Expected at most one kernels entry in global scope of .ze_info, got : 2\n", decodeErrors.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Expected at most one kernels entry in global scope of .ze_info, got : 2\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleVersionSectionsThenFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleVersionSectionsThenFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto brokenZeInfo = std::string("version:\'") + versionToString(zeInfoDecoderVersion) + "\'\nversion:\'5.4\'\nkernels:\n";
|
auto brokenZeInfo = std::string("version:\'") + versionToString(zeInfoDecoderVersion) + "\'\nversion:\'5.4\'\nkernels:\n";
|
||||||
@@ -2907,13 +2940,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoContainsMultipleVersionSectionsThe
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Expected at most one version entry in global scope of .ze_info, got : 2\n", decodeErrors.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Expected at most one version entry in global scope of .ze_info, got : 2\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainVersionSectionsThenEmitsWarnings) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainVersionSectionsThenEmitsWarnings) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto zeInfo = ConstStringRef("kernels:\n");
|
auto zeInfo = ConstStringRef("kernels:\n");
|
||||||
@@ -2928,13 +2963,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoDoesNotContainVersionSectionsThenE
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ(expectedWarning.c_str(), decodeWarnings.c_str());
|
EXPECT_STREQ(expectedWarning.c_str(), decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoVersionIsInvalidThenFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoVersionIsInvalidThenFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto zeInfo = ConstStringRef("version:\'1a\'\nkernels:\n");
|
auto zeInfo = ConstStringRef("version:\'1a\'\nkernels:\n");
|
||||||
@@ -2945,13 +2982,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoVersionIsInvalidThenFails) {
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Invalid version format - expected 'MAJOR.MINOR' string, got : 1a\n", decodeErrors.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Invalid version format - expected 'MAJOR.MINOR' string, got : 1a\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMinorVersionIsNewerThenEmitsWarning) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMinorVersionIsNewerThenEmitsWarning) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
auto version = NEO::zeInfoDecoderVersion;
|
auto version = NEO::zeInfoDecoderVersion;
|
||||||
@@ -2965,13 +3004,15 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMinorVersionIsNewerThenEmitsWarnin
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_STREQ(expectedWarning.c_str(), decodeWarnings.c_str());
|
EXPECT_STREQ(expectedWarning.c_str(), decodeWarnings.c_str());
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
{
|
{
|
||||||
ZebinTestData::ValidEmptyProgram zebin;
|
ZebinTestData::ValidEmptyProgram zebin;
|
||||||
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
zebin.removeSection(NEO::Elf::SHT_ZEBIN::SHT_ZEBIN_ZEINFO, NEO::Elf::SectionsNamesZebin::zeInfo);
|
||||||
@@ -2985,7 +3026,7 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails)
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::UnhandledBinary, error);
|
EXPECT_EQ(NEO::DecodeError::UnhandledBinary, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unhandled major version : 2, decoder is at : 1\n", decodeErrors.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unhandled major version : 2, decoder is at : 1\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
@@ -3004,7 +3045,7 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails)
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::UnhandledBinary, error);
|
EXPECT_EQ(NEO::DecodeError::UnhandledBinary, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unhandled major version : 0, decoder is at : 1\n", decodeErrors.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin::.ze_info : Unhandled major version : 0, decoder is at : 1\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
@@ -3012,6 +3053,8 @@ TEST(DecodeSingleDeviceBinaryZebin, WhenZeInfoMajorVersionIsMismatchedThenFails)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, WhenDecodeZeInfoFailsThenDecodingFails) {
|
TEST(DecodeSingleDeviceBinaryZebin, WhenDecodeZeInfoFailsThenDecodingFails) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
std::string brokenZeInfo = "version : \'" + versionToString(zeInfoDecoderVersion) + R"===('
|
std::string brokenZeInfo = "version : \'" + versionToString(zeInfoDecoderVersion) + R"===('
|
||||||
kernels:
|
kernels:
|
||||||
-
|
-
|
||||||
@@ -3026,13 +3069,15 @@ kernels:
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
EXPECT_STREQ("DeviceBinaryFormat::Zebin : Expected exactly 1 of name section, got : 0\nDeviceBinaryFormat::Zebin : Expected exactly 1 of execution_env section, got : 0\n", decodeErrors.c_str());
|
EXPECT_STREQ("DeviceBinaryFormat::Zebin : Expected exactly 1 of name section, got : 0\nDeviceBinaryFormat::Zebin : Expected exactly 1 of execution_env section, got : 0\n", decodeErrors.c_str());
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenValidZeInfoThenPopulatesKernelDescriptorProperly) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenValidZeInfoThenPopulatesKernelDescriptorProperly) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
||||||
kernels:
|
kernels:
|
||||||
- name : some_kernel
|
- name : some_kernel
|
||||||
@@ -3053,7 +3098,7 @@ kernels:
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
@@ -3068,6 +3113,9 @@ kernels:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenValidZeInfoAndExternalFunctionsMetadataThenPopulatesExternalFunctionMetadataProperly) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenValidZeInfoAndExternalFunctionsMetadataThenPopulatesExternalFunctionMetadataProperly) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
|
|
||||||
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
||||||
kernels:
|
kernels:
|
||||||
- name : some_kernel
|
- name : some_kernel
|
||||||
@@ -3091,7 +3139,7 @@ functions:
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
EXPECT_TRUE(decodeWarnings.empty()) << decodeWarnings;
|
||||||
@@ -3105,6 +3153,8 @@ functions:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenValidZeInfoAndInvalidExternalFunctionsMetadataThenFail) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenValidZeInfoAndInvalidExternalFunctionsMetadataThenFail) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
||||||
kernels:
|
kernels:
|
||||||
- name : some_kernel
|
- name : some_kernel
|
||||||
@@ -3127,7 +3177,7 @@ functions:
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
const std::string expectedError = "DeviceBinaryFormat::Zebin::.ze_info : could not read grf_count from : [abc] in context of : external functions\nDeviceBinaryFormat::Zebin::.ze_info : could not read simd_size from : [defgas] in context of : external functions\n";
|
const std::string expectedError = "DeviceBinaryFormat::Zebin::.ze_info : could not read grf_count from : [abc] in context of : external functions\nDeviceBinaryFormat::Zebin::.ze_info : could not read simd_size from : [defgas] in context of : external functions\n";
|
||||||
EXPECT_STREQ(expectedError.c_str(), decodeErrors.c_str());
|
EXPECT_STREQ(expectedError.c_str(), decodeErrors.c_str());
|
||||||
@@ -3135,6 +3185,8 @@ functions:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, GivenZeInfoWithTwoExternalFunctionsEntriesThenFail) {
|
TEST(DecodeSingleDeviceBinaryZebin, GivenZeInfoWithTwoExternalFunctionsEntriesThenFail) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
std::string validZeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
||||||
kernels:
|
kernels:
|
||||||
- name : some_kernel
|
- name : some_kernel
|
||||||
@@ -3162,7 +3214,7 @@ functions:
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
const std::string expectedError = "DeviceBinaryFormat::Zebin::.ze_info : Expected at most one functions entry in global scope of .ze_info, got : 2\n";
|
const std::string expectedError = "DeviceBinaryFormat::Zebin::.ze_info : Expected at most one functions entry in global scope of .ze_info, got : 2\n";
|
||||||
EXPECT_STREQ(expectedError.c_str(), decodeErrors.c_str());
|
EXPECT_STREQ(expectedError.c_str(), decodeErrors.c_str());
|
||||||
@@ -3170,6 +3222,8 @@ functions:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(DecodeSingleDeviceBinaryZebin, givenZeInfoWithKernelsMiscInfoSectionWhenDecodingBinaryThenDoNotParseThisSection) {
|
TEST(DecodeSingleDeviceBinaryZebin, givenZeInfoWithKernelsMiscInfoSectionWhenDecodingBinaryThenDoNotParseThisSection) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
std::string zeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
std::string zeInfo = std::string("version :\'") + versionToString(zeInfoDecoderVersion) + R"===('
|
||||||
kernels:
|
kernels:
|
||||||
- name: kernel1
|
- name: kernel1
|
||||||
@@ -3199,7 +3253,7 @@ kernels_misc_info:
|
|||||||
singleBinary.deviceBinary = {zebin.storage.data(), zebin.storage.size()};
|
singleBinary.deviceBinary = {zebin.storage.data(), zebin.storage.size()};
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeWarnings.empty());
|
EXPECT_TRUE(decodeWarnings.empty());
|
||||||
EXPECT_TRUE(decodeErrors.empty());
|
EXPECT_TRUE(decodeErrors.empty());
|
||||||
@@ -6662,6 +6716,9 @@ TEST(ValidateTargetDeviceTests, givenSteppingBiggerThanMaxHwRevisionWhenValidati
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(PopulateGlobalDeviceHostNameMapping, givenValidZebinWithGlobalHostAccessTableSectionThenPopulateHostDeviceNameMapCorrectly) {
|
TEST(PopulateGlobalDeviceHostNameMapping, givenValidZebinWithGlobalHostAccessTableSectionThenPopulateHostDeviceNameMapCorrectly) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
|
|
||||||
NEO::ConstStringRef zeinfo = R"===(
|
NEO::ConstStringRef zeinfo = R"===(
|
||||||
kernels:
|
kernels:
|
||||||
- name : some_kernel
|
- name : some_kernel
|
||||||
@@ -6684,7 +6741,7 @@ TEST(PopulateGlobalDeviceHostNameMapping, givenValidZebinWithGlobalHostAccessTab
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::Success, error);
|
EXPECT_EQ(NEO::DecodeError::Success, error);
|
||||||
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
EXPECT_TRUE(decodeErrors.empty()) << decodeErrors;
|
||||||
|
|
||||||
@@ -6694,6 +6751,9 @@ TEST(PopulateGlobalDeviceHostNameMapping, givenValidZebinWithGlobalHostAccessTab
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(PopulateGlobalDeviceHostNameMapping, givenZebinWithGlobalHostAccessTableSectionAndInvalidValuesThenReturnInvalidBinaryError) {
|
TEST(PopulateGlobalDeviceHostNameMapping, givenZebinWithGlobalHostAccessTableSectionAndInvalidValuesThenReturnInvalidBinaryError) {
|
||||||
|
NEO::MockExecutionEnvironment mockExecutionEnvironment{};
|
||||||
|
auto &gfxCoreHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<NEO::GfxCoreHelper>();
|
||||||
|
|
||||||
std::vector<NEO::ConstStringRef> invalidZeInfos{R"===(
|
std::vector<NEO::ConstStringRef> invalidZeInfos{R"===(
|
||||||
kernels:
|
kernels:
|
||||||
- name : some_kernel
|
- name : some_kernel
|
||||||
@@ -6723,7 +6783,7 @@ TEST(PopulateGlobalDeviceHostNameMapping, givenZebinWithGlobalHostAccessTableSec
|
|||||||
singleBinary.deviceBinary = zebin.storage;
|
singleBinary.deviceBinary = zebin.storage;
|
||||||
std::string decodeErrors;
|
std::string decodeErrors;
|
||||||
std::string decodeWarnings;
|
std::string decodeWarnings;
|
||||||
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings);
|
auto error = NEO::decodeSingleDeviceBinary<NEO::DeviceBinaryFormat::Zebin>(programInfo, singleBinary, decodeErrors, decodeWarnings, gfxCoreHelper);
|
||||||
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
EXPECT_EQ(NEO::DecodeError::InvalidBinary, error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user