feature: New allocators for opaque arrays

Adds fast allocators for opaque objects of uniform size.

Related-To: NEO-13406

Signed-off-by: Chodor, Jaroslaw <jaroslaw.chodor@intel.com>
This commit is contained in:
Chodor, Jaroslaw
2025-02-26 14:32:25 +00:00
committed by Compute-Runtime-Automation
parent 1a2666d4e2
commit 0bff9def3b
6 changed files with 524 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -92,3 +92,20 @@ TEST(ptrDiff, WhenGettingPtrDiffThen64BitIsPreserved) {
auto ptrBefore3 = ptrDiff(ptrAfter, 0x1234ull);
EXPECT_EQ(0x800000000ull, ptrBefore3);
}
TEST(ByteRangeContains, WhenInRangeThenReturnTrue) {
char stack[3] = {};
EXPECT_TRUE(byteRangeContains(stack, 3, &stack[0]));
EXPECT_TRUE(byteRangeContains(stack, 3, &stack[1]));
EXPECT_TRUE(byteRangeContains(stack, 3, &stack[2]));
}
TEST(ByteRangeContains, WhenNotInRangeThenReturnFalse) {
char stack[3] = {};
std::vector<char> heap(3, 0);
EXPECT_FALSE(byteRangeContains(stack + 1, 1, &stack[2]));
EXPECT_FALSE(byteRangeContains(stack + 1, 1, &stack[0]));
EXPECT_FALSE(byteRangeContains(stack, 3, &heap[0]));
EXPECT_FALSE(byteRangeContains(stack, 3, &heap[1]));
EXPECT_FALSE(byteRangeContains(stack, 3, &heap[2]));
}