mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 18:37:46 +08:00
This commits moves debugData and debugDataSize to buildInfos vector (per root device). - debug data is now stored per device instead of per cl_program - added creation of debug data (incl. debug zebin) and its returning in clGetProgramInfo (CL_PROGRAM_DEBUG_INFO_INTEL). Related-To: NEO-6463 Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
64 lines
2.4 KiB
C++
64 lines
2.4 KiB
C++
/*
|
|
* Copyright (C) 2022 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "opencl/test/unit_test/program/program_with_zebin.h"
|
|
|
|
#include "shared/test/unit_test/device_binary_format/zebin_tests.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_buffer.h"
|
|
|
|
using namespace NEO;
|
|
|
|
void ProgramWithZebinFixture::SetUp() {
|
|
ProgramTests::SetUp();
|
|
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
|
|
}
|
|
|
|
void ProgramWithZebinFixture::TearDown() {
|
|
program->setGlobalSurface(nullptr);
|
|
program->setConstantSurface(nullptr);
|
|
program->getKernelInfoArray(rootDeviceIndex).clear();
|
|
ProgramTests::TearDown();
|
|
}
|
|
|
|
void ProgramWithZebinFixture::addEmptyZebin(NEO::MockProgram *program) {
|
|
auto zebin = ZebinTestData::ValidEmptyProgram();
|
|
|
|
program->buildInfos[rootDeviceIndex].unpackedDeviceBinarySize = zebin.storage.size();
|
|
program->buildInfos[rootDeviceIndex].unpackedDeviceBinary.reset(new char[zebin.storage.size()]);
|
|
memcpy_s(program->buildInfos[rootDeviceIndex].unpackedDeviceBinary.get(), program->buildInfos[rootDeviceIndex].unpackedDeviceBinarySize,
|
|
zebin.storage.data(), zebin.storage.size());
|
|
}
|
|
|
|
void ProgramWithZebinFixture::populateProgramWithSegments(NEO::MockProgram *program) {
|
|
kernelInfo = std::make_unique<KernelInfo>();
|
|
kernelInfo->kernelDescriptor.kernelMetadata.kernelName = kernelName;
|
|
mockAlloc = std::make_unique<MockGraphicsAllocation>();
|
|
kernelInfo->kernelAllocation = mockAlloc.get();
|
|
|
|
program->addKernelInfo(kernelInfo.get(), rootDeviceIndex);
|
|
|
|
globalSurface = std::make_unique<MockBuffer>();
|
|
constantSurface = std::make_unique<MockBuffer>();
|
|
program->setGlobalSurface(&globalSurface->mockGfxAllocation);
|
|
program->setConstantSurface(&constantSurface->mockGfxAllocation);
|
|
|
|
program->buildInfos[rootDeviceIndex].constStringSectionData.initData = &strings;
|
|
program->buildInfos[rootDeviceIndex].constStringSectionData.size = sizeof(strings);
|
|
}
|
|
|
|
void ProgramWithDebugDataCreationFixture::SetUp() {
|
|
ProgramWithZebinFixture::SetUp();
|
|
programWithDebugDataCreation = std::make_unique<MockProgramWithDebugDataCreation>(toClDeviceVector(*pClDevice));
|
|
}
|
|
|
|
void ProgramWithDebugDataCreationFixture::TearDown() {
|
|
programWithDebugDataCreation->setGlobalSurface(nullptr);
|
|
programWithDebugDataCreation->setConstantSurface(nullptr);
|
|
programWithDebugDataCreation->getKernelInfoArray(rootDeviceIndex).clear();
|
|
ProgramWithZebinFixture::TearDown();
|
|
} |