mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Relocate debug data
Related-To: NEO-4769 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a0d3e8b352
commit
6dd0f0c728
@@ -63,6 +63,9 @@ struct KernelImmutableData {
|
||||
const NEO::KernelInfo *getKernelInfo() const { return kernelInfo; }
|
||||
|
||||
protected:
|
||||
MOCKABLE_VIRTUAL void createRelocatedDebugData(NEO::GraphicsAllocation *globalConstBuffer,
|
||||
NEO::GraphicsAllocation *globalVarBuffer);
|
||||
|
||||
Device *device = nullptr;
|
||||
NEO::KernelInfo *kernelInfo = nullptr;
|
||||
NEO::KernelDescriptor *kernelDescriptor = nullptr;
|
||||
|
||||
@@ -121,8 +121,12 @@ void KernelImmutableData::initialize(NEO::KernelInfo *kernelInfo, Device *device
|
||||
}
|
||||
|
||||
isaGraphicsAllocation.reset(allocation);
|
||||
if (device->getL0Debugger() && kernelInfo->kernelDescriptor.external.debugData.get()) {
|
||||
device->getL0Debugger()->registerElf(kernelInfo->kernelDescriptor.external.debugData.get(), allocation);
|
||||
|
||||
if (neoDevice->getDebugger() && kernelInfo->kernelDescriptor.external.debugData.get()) {
|
||||
createRelocatedDebugData(globalConstBuffer, globalVarBuffer);
|
||||
if (device->getL0Debugger()) {
|
||||
device->getL0Debugger()->registerElf(kernelInfo->kernelDescriptor.external.debugData.get(), allocation);
|
||||
}
|
||||
}
|
||||
|
||||
this->crossThreadDataSize = this->kernelDescriptor->kernelAttributes.crossThreadDataSize;
|
||||
@@ -185,6 +189,41 @@ void KernelImmutableData::initialize(NEO::KernelInfo *kernelInfo, Device *device
|
||||
}
|
||||
}
|
||||
|
||||
void KernelImmutableData::createRelocatedDebugData(NEO::GraphicsAllocation *globalConstBuffer,
|
||||
NEO::GraphicsAllocation *globalVarBuffer) {
|
||||
NEO::Linker::SegmentInfo globalData;
|
||||
NEO::Linker::SegmentInfo constData;
|
||||
if (globalVarBuffer) {
|
||||
globalData.gpuAddress = globalVarBuffer->getGpuAddress();
|
||||
globalData.segmentSize = globalVarBuffer->getUnderlyingBufferSize();
|
||||
}
|
||||
if (globalConstBuffer) {
|
||||
constData.gpuAddress = globalConstBuffer->getGpuAddress();
|
||||
constData.segmentSize = globalConstBuffer->getUnderlyingBufferSize();
|
||||
}
|
||||
|
||||
if (kernelInfo->kernelDescriptor.external.debugData.get()) {
|
||||
std::string outErrReason;
|
||||
std::string outWarning;
|
||||
auto decodedElf = NEO::Elf::decodeElf<NEO::Elf::EI_CLASS_64>(ArrayRef<const uint8_t>(reinterpret_cast<const uint8_t *>(kernelInfo->kernelDescriptor.external.debugData->vIsa),
|
||||
kernelInfo->kernelDescriptor.external.debugData->vIsaSize),
|
||||
outErrReason, outWarning);
|
||||
|
||||
if (decodedElf.getDebugInfoRelocations().size() > 1) {
|
||||
auto size = kernelInfo->kernelDescriptor.external.debugData->vIsaSize;
|
||||
kernelInfo->kernelDescriptor.external.relocatedDebugData = std::make_unique<uint8_t[]>(size);
|
||||
|
||||
memcpy_s(kernelInfo->kernelDescriptor.external.relocatedDebugData.get(), size, kernelInfo->kernelDescriptor.external.debugData->vIsa, kernelInfo->kernelDescriptor.external.debugData->vIsaSize);
|
||||
|
||||
NEO::Linker::SegmentInfo textSegment = {getIsaGraphicsAllocation()->getGpuAddress(),
|
||||
getIsaGraphicsAllocation()->getUnderlyingBufferSize()};
|
||||
|
||||
NEO::Linker::applyDebugDataRelocations(decodedElf, ArrayRef<uint8_t>(kernelInfo->kernelDescriptor.external.relocatedDebugData.get(), size),
|
||||
textSegment, globalData, constData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t KernelImmutableData::getIsaSize() const {
|
||||
return static_cast<uint32_t>(isaGraphicsAllocation->getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user