fix: prevent underflow in per thread data offset calculation

Related-To: NEO-14719

Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
Naklicki, Mateusz
2025-06-16 12:44:39 +00:00
committed by Compute-Runtime-Automation
parent 6368f43df8
commit b462f990b6
4 changed files with 88 additions and 13 deletions

View File

@@ -273,3 +273,20 @@ TEST(KernelDescriptor, GivenDescriptorWithoutStatefulArgsWhenInitBindlessOffsets
desc.initBindlessOffsetToSurfaceState();
EXPECT_EQ(0u, desc.bindlessArgsMap.size());
}
TEST(KernelDescriptor, GivenDescriptorWhenGettingPerThreadDataOffsetThenItReturnsCorrectValue) {
NEO::KernelDescriptor desc{};
desc.kernelAttributes.crossThreadDataSize = 64u;
desc.kernelAttributes.inlineDataPayloadSize = 64u;
EXPECT_EQ(0u, desc.getPerThreadDataOffset());
// crossThreadData is fully consumed by inlineDataPayload
desc.kernelAttributes.crossThreadDataSize = 40u;
desc.kernelAttributes.inlineDataPayloadSize = 64u;
EXPECT_EQ(0u, desc.getPerThreadDataOffset());
desc.kernelAttributes.crossThreadDataSize = 128u;
desc.kernelAttributes.inlineDataPayloadSize = 64u;
EXPECT_EQ(64u, desc.getPerThreadDataOffset());
}