mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-20 13:11:34 +08:00
Create debug zebin in OCL
This commit adds debug zebin creation in OCL. - Added returning debug zebin in build/linking paths in OCL if corresponding device binary format was detected. - Refactored getZebinSegments() method - added common ctor for both L0/OCL paths Signed-off-by: Kacper Nowak <kacper.nowak@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
59683ec491
commit
fc224202d6
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -9,11 +9,30 @@
|
||||
|
||||
#include "shared/source/device_binary_format/elf/elf_decoder.h"
|
||||
#include "shared/source/device_binary_format/elf/elf_encoder.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
|
||||
namespace NEO {
|
||||
namespace Debug {
|
||||
using namespace Elf;
|
||||
|
||||
Segments::Segments() {}
|
||||
|
||||
Segments::Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAllocation *globalConstAlloc, ArrayRef<const uint8_t> &globalStrings, std::vector<KernelNameIsaPairT> &kernels) {
|
||||
if (globalVarAlloc) {
|
||||
varData = {static_cast<uintptr_t>(globalVarAlloc->getGpuAddressToPatch()), {reinterpret_cast<uint8_t *>(globalVarAlloc->getUnderlyingBuffer()), globalVarAlloc->getUnderlyingBufferSize()}};
|
||||
}
|
||||
if (globalConstAlloc) {
|
||||
constData = {static_cast<uintptr_t>(globalConstAlloc->getGpuAddressToPatch()), {reinterpret_cast<uint8_t *>(globalConstAlloc->getUnderlyingBuffer()), globalConstAlloc->getUnderlyingBufferSize()}};
|
||||
}
|
||||
if (false == globalStrings.empty()) {
|
||||
stringData = {reinterpret_cast<uintptr_t>(globalStrings.begin()), globalStrings};
|
||||
}
|
||||
for (auto &[kernelName, isa] : kernels) {
|
||||
Debug::Segments::Segment kernelSegment = {static_cast<uintptr_t>(isa->getGpuAddressToPatch()), {reinterpret_cast<uint8_t *>(isa->getUnderlyingBuffer()), isa->getUnderlyingBufferSize()}};
|
||||
nameToSegMap.insert(std::pair(kernelName, kernelSegment));
|
||||
}
|
||||
}
|
||||
|
||||
void DebugZebinCreator::createDebugZebin() {
|
||||
ElfEncoder<EI_CLASS_64> elfEncoder(false, false);
|
||||
auto &header = elfEncoder.getElfFileHeader();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -15,6 +15,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class GraphicsAllocation;
|
||||
namespace Debug {
|
||||
struct Segments {
|
||||
struct Segment {
|
||||
@ -23,12 +24,15 @@ struct Segments {
|
||||
};
|
||||
using CPUSegment = Segment;
|
||||
using GPUSegment = Segment;
|
||||
using KernelNameIsaPairT = std::pair<std::string_view, GraphicsAllocation *>;
|
||||
using KernelNameToSegmentMap = std::unordered_map<std::string, GPUSegment>;
|
||||
|
||||
GPUSegment varData;
|
||||
GPUSegment constData;
|
||||
CPUSegment stringData;
|
||||
KernelNameToSegmentMap nameToSegMap;
|
||||
Segments();
|
||||
Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAllocation *globalConstAlloc, ArrayRef<const uint8_t> &globalStrings, std::vector<KernelNameIsaPairT> &kernels);
|
||||
};
|
||||
|
||||
class DebugZebinCreator {
|
||||
|
Reference in New Issue
Block a user