fix: correct program header generation for shared isa allocation

- when kernels share single allocation, LOAD address in program headers
should point to correct virtual address including kernel offset

Related-To: NEO-7788, GSD-9836

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-09-03 16:23:32 +00:00
committed by Compute-Runtime-Automation
parent 43e3957e66
commit 37b7caa137
5 changed files with 81 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -18,7 +18,7 @@ using namespace NEO::Zebin::Elf;
Segments::Segments() {}
Segments::Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAllocation *globalConstAlloc, ArrayRef<const uint8_t> &globalStrings, std::vector<KernelNameIsaPairT> &kernels) {
Segments::Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAllocation *globalConstAlloc, ArrayRef<const uint8_t> &globalStrings, std::vector<KernelNameIsaTupleT> &kernels) {
if (globalVarAlloc) {
varData = {static_cast<uintptr_t>(globalVarAlloc->getGpuAddress()), globalVarAlloc->getUnderlyingBufferSize()};
}
@@ -28,9 +28,8 @@ Segments::Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAlloc
if (false == globalStrings.empty()) {
stringData = {reinterpret_cast<uintptr_t>(globalStrings.begin()), globalStrings.size()};
}
for (auto &[kernelName, isa] : kernels) {
Debug::Segments::Segment kernelSegment = {static_cast<uintptr_t>(isa->getGpuAddress()), isa->getUnderlyingBufferSize()};
nameToSegMap.insert(std::pair(kernelName, kernelSegment));
for (auto &[kernelName, isaSegment] : kernels) {
nameToSegMap.insert(std::pair(kernelName, isaSegment));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2023 Intel Corporation
* Copyright (C) 2021-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -26,7 +26,7 @@ struct Segments {
};
using CPUSegment = Segment;
using GPUSegment = Segment;
using KernelNameIsaPairT = std::pair<std::string_view, GraphicsAllocation *>;
using KernelNameIsaTupleT = std::tuple<std::string_view, Segment>;
using KernelNameToSegmentMap = std::unordered_map<std::string, GPUSegment>;
GPUSegment varData;
@@ -34,7 +34,7 @@ struct Segments {
CPUSegment stringData;
KernelNameToSegmentMap nameToSegMap;
Segments();
Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAllocation *globalConstAlloc, ArrayRef<const uint8_t> &globalStrings, std::vector<KernelNameIsaPairT> &kernels);
Segments(const GraphicsAllocation *globalVarAlloc, const GraphicsAllocation *globalConstAlloc, ArrayRef<const uint8_t> &globalStrings, std::vector<KernelNameIsaTupleT> &kernels);
};
class DebugZebinCreator {