mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
fix: patch correct payload offset value in relocation
Related-To:: GSD-8116 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
63843862df
commit
b755a30919
@@ -440,7 +440,8 @@ void Linker::patchInstructionsSegments(const std::vector<PatchableSegment> &inst
|
||||
|
||||
auto relocAddress = ptrOffset(segment.hostPointer, static_cast<uintptr_t>(relocation.offset));
|
||||
if (relocation.type == LinkerInput::RelocationInfo::Type::perThreadPayloadOffset) {
|
||||
*reinterpret_cast<uint32_t *>(relocAddress) = kernelDescriptors.at(segId)->kernelAttributes.crossThreadDataSize;
|
||||
uint32_t crossThreadDataSize = kernelDescriptors.at(segId)->kernelAttributes.crossThreadDataSize - kernelDescriptors.at(segId)->kernelAttributes.inlineDataPayloadSize;
|
||||
*reinterpret_cast<uint32_t *>(relocAddress) = crossThreadDataSize;
|
||||
} else if (relocation.symbolName == implicitArgsRelocationSymbolName) {
|
||||
pImplicitArgsRelocationAddresses[static_cast<uint32_t>(segId)].push_back(reinterpret_cast<uint32_t *>(relocAddress));
|
||||
} else if (relocation.symbolName.empty()) {
|
||||
|
||||
@@ -2378,7 +2378,8 @@ TEST_F(LinkerTests, givenPerThreadPayloadOffsetRelocationWhenPatchingInstruction
|
||||
|
||||
NEO::Linker::KernelDescriptorsT kernelDescriptors;
|
||||
KernelDescriptor kd;
|
||||
kd.kernelAttributes.crossThreadDataSize = 0x20;
|
||||
kd.kernelAttributes.crossThreadDataSize = 0x40;
|
||||
kd.kernelAttributes.inlineDataPayloadSize = 0x20;
|
||||
kernelDescriptors.push_back(&kd);
|
||||
|
||||
WhiteBox<NEO::Linker> linker(linkerInput);
|
||||
@@ -2391,5 +2392,6 @@ TEST_F(LinkerTests, givenPerThreadPayloadOffsetRelocationWhenPatchingInstruction
|
||||
NEO::Linker::UnresolvedExternals unresolvedExternals;
|
||||
linker.patchInstructionsSegments({segmentToPatch}, unresolvedExternals, kernelDescriptors);
|
||||
auto perThreadPayloadOffsetPatchedValue = reinterpret_cast<uint32_t *>(ptrOffset(segmentToPatch.hostPointer, static_cast<size_t>(rel.offset)));
|
||||
EXPECT_EQ(kd.kernelAttributes.crossThreadDataSize, static_cast<uint32_t>(*perThreadPayloadOffsetPatchedValue));
|
||||
uint32_t expectedPatchedValue = kd.kernelAttributes.crossThreadDataSize - kd.kernelAttributes.inlineDataPayloadSize;
|
||||
EXPECT_EQ(expectedPatchedValue, static_cast<uint32_t>(*perThreadPayloadOffsetPatchedValue));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user