mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 01:35:20 +08:00
refactor(zebin): move files to seperate directory
* Moved zebin related files to zebin directory. * Moved zebin related code to Zebin namespace. * Separated zeInfo from zebin elf. * Seperated zeInfo decoding from zebin decoder. * Refactored populateKernelPayloadArgument function. Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
210b4cfeea
commit
58d3f892a9
68
shared/source/device_binary_format/zebin/debug_zebin.h
Normal file
68
shared/source/device_binary_format/zebin/debug_zebin.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/device_binary_format/elf/elf_decoder.h"
|
||||
#include "shared/source/device_binary_format/zebin/zebin_elf.h"
|
||||
#include "shared/source/utilities/arrayref.h"
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class GraphicsAllocation;
|
||||
namespace Zebin::Debug {
|
||||
struct Segments {
|
||||
struct Segment {
|
||||
uintptr_t address = std::numeric_limits<uintptr_t>::max();
|
||||
size_t size = 0;
|
||||
};
|
||||
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 {
|
||||
public:
|
||||
using Elf = NEO::Elf::Elf<NEO::Elf::EI_CLASS_64>;
|
||||
DebugZebinCreator() = delete;
|
||||
DebugZebinCreator(Elf &zebin, const Segments &segments) : segments(segments), zebin(zebin) {}
|
||||
|
||||
void applyRelocations();
|
||||
void createDebugZebin();
|
||||
inline std::vector<uint8_t> getDebugZebin() { return debugZebin; }
|
||||
|
||||
protected:
|
||||
void applyRelocation(uintptr_t addr, uint64_t value, NEO::Zebin::Elf::RELOC_TYPE_ZEBIN type);
|
||||
bool isRelocTypeSupported(NEO::Zebin::Elf::RELOC_TYPE_ZEBIN type);
|
||||
const Segments::Segment *getSegmentByName(ConstStringRef sectionName);
|
||||
const Segments::Segment *getTextSegmentByName(ConstStringRef textSegmentName);
|
||||
bool isCpuSegment(ConstStringRef sectionName);
|
||||
|
||||
const Segments &segments;
|
||||
const Elf &zebin;
|
||||
uint32_t symTabShndx = std::numeric_limits<uint32_t>::max();
|
||||
std::vector<uint8_t> debugZebin;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void patchWithValue(uintptr_t addr, T value);
|
||||
|
||||
std::vector<uint8_t> createDebugZebin(ArrayRef<const uint8_t> zebin, const Segments &segmentData);
|
||||
} // namespace Zebin::Debug
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user