mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 16:24:18 +08:00
Add debugData to packedBinary
Change-Id: Id6e3fe6b6b2da383f042d66c9638ccec6989ca71 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
d03a574ef2
commit
856a2f7be7
@@ -469,6 +469,8 @@ cl_int Program::packDeviceBinary() {
|
||||
singleDeviceBinary.targetDevice.stepping = stepping;
|
||||
singleDeviceBinary.deviceBinary = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->unpackedDeviceBinary.get()), this->unpackedDeviceBinarySize);
|
||||
singleDeviceBinary.intermediateRepresentation = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->irBinary.get()), this->irBinarySize);
|
||||
singleDeviceBinary.debugData = ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(this->debugData.get()), this->debugDataSize);
|
||||
|
||||
std::string packWarnings;
|
||||
std::string packErrors;
|
||||
auto packedDeviceBinary = NEO::packDeviceBinary(singleDeviceBinary, packErrors, packWarnings);
|
||||
|
||||
@@ -366,6 +366,7 @@ set(TEST_KERNEL_options
|
||||
"-cl-finite-math-only"
|
||||
"-cl-kernel-arg-info"
|
||||
"-x spir -spir-std=1.2"
|
||||
"-g"
|
||||
)
|
||||
|
||||
set(TEST_KERNEL_2_0_options
|
||||
|
||||
@@ -1649,6 +1649,71 @@ INSTANTIATE_TEST_CASE_P(ProgramFromSourceTests,
|
||||
::testing::ValuesIn(BinaryForSourceFileNames),
|
||||
::testing::ValuesIn(KernelNames)));
|
||||
|
||||
using ProgramWithDebugSymbolsTests = Test<ProgramSimpleFixture>;
|
||||
|
||||
TEST_F(ProgramWithDebugSymbolsTests, GivenProgramCreatedWithDashGOptionWhenGettingProgramBinariesThenDebugDataIsIncluded) {
|
||||
cl_device_id device = pClDevice;
|
||||
|
||||
CreateProgramFromBinary(pContext, &device, "CopyBuffer_simd16", "-g");
|
||||
|
||||
ASSERT_NE(nullptr, pProgram);
|
||||
|
||||
retVal = pProgram->build(
|
||||
1,
|
||||
&device,
|
||||
"-g",
|
||||
nullptr,
|
||||
nullptr,
|
||||
false);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
size_t paramValueSize = sizeof(size_t);
|
||||
size_t paramValueSizeRet = 0;
|
||||
size_t size = 0;
|
||||
|
||||
pProgram->packedDeviceBinary.reset();
|
||||
pProgram->packedDeviceBinarySize = 0U;
|
||||
|
||||
retVal = pProgram->packDeviceBinary();
|
||||
|
||||
retVal = pProgram->getInfo(
|
||||
CL_PROGRAM_BINARY_SIZES,
|
||||
paramValueSize,
|
||||
&size,
|
||||
nullptr);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
auto testBinary = std::make_unique<char[]>(size);
|
||||
|
||||
retVal = pProgram->getInfo(
|
||||
CL_PROGRAM_BINARIES,
|
||||
paramValueSize,
|
||||
&testBinary,
|
||||
¶mValueSizeRet);
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
|
||||
ArrayRef<const uint8_t> archive(reinterpret_cast<const uint8_t *>(testBinary.get()), size);
|
||||
auto productAbbreviation = hardwarePrefix[pDevice->getHardwareInfo().platform.eProductFamily];
|
||||
|
||||
TargetDevice targetDevice = {};
|
||||
|
||||
auto &hwHelper = NEO::HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
auto copyHwInfo = *defaultHwInfo;
|
||||
hwHelper.adjustPlatformCoreFamilyForIgc(copyHwInfo);
|
||||
targetDevice.coreFamily = copyHwInfo.platform.eRenderCoreFamily;
|
||||
targetDevice.stepping = copyHwInfo.platform.usRevId;
|
||||
targetDevice.maxPointerSizeInBytes = sizeof(uintptr_t);
|
||||
|
||||
std::string decodeErrors;
|
||||
std::string decodeWarnings;
|
||||
auto singleDeviceBinary = unpackSingleDeviceBinary(archive, ConstStringRef(productAbbreviation, strlen(productAbbreviation)), targetDevice,
|
||||
decodeErrors, decodeWarnings);
|
||||
|
||||
EXPECT_FALSE(singleDeviceBinary.debugData.empty());
|
||||
}
|
||||
|
||||
TEST_F(ProgramTests, WhenProgramIsCreatedThenCorrectOclVersionIsInOptions) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.DisableStatelessToStatefulOptimization.set(false);
|
||||
|
||||
Reference in New Issue
Block a user