Skip to content

Commit 639a5a6

Browse files
Add getAllocationDataExtra method
Change-Id: I99d9d55bf1b4116d7766f86471f6cd716374be5c Signed-off-by: Maciej Dziuban <[email protected]>
1 parent 79c1498 commit 639a5a6

File tree

8 files changed

+91
-61
lines changed

8 files changed

+91
-61
lines changed

opencl/test/unit_test/helpers/unit_test_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ struct UnitTestHelper {
4646

4747
static uint64_t getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic);
4848

49+
static bool requiresTimestampPacketsInSystemMemory();
50+
4951
static const bool tiledImagesSupported;
5052

5153
static const uint32_t smallestTestableSimdSize;

opencl/test/unit_test/helpers/unit_test_helper.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ inline uint64_t UnitTestHelper<GfxFamily>::getMemoryAddress(const typename GfxFa
8080
return atomic.getMemoryAddress() | ((static_cast<uint64_t>(atomic.getMemoryAddressHigh())) << 32);
8181
}
8282

83+
template <typename GfxFamily>
84+
inline bool UnitTestHelper<GfxFamily>::requiresTimestampPacketsInSystemMemory() {
85+
return true;
86+
}
87+
8388
template <typename GfxFamily>
8489
const bool UnitTestHelper<GfxFamily>::tiledImagesSupported = true;
8590

opencl/test/unit_test/memory_manager/memory_manager_allocate_in_preferred_pool_tests.inl

Lines changed: 61 additions & 56 deletions
Large diffs are not rendered by default.

opencl/test/unit_test/memory_manager/memory_manager_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAskedFor32BitAllocationWhenL
629629
memoryManager.forceLimitedRangeAllocator(0, 0xFFFFFFFFF);
630630

631631
AllocationData allocationData;
632-
MockMemoryManager::getAllocationData(allocationData, {0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
632+
memoryManager.getAllocationData(allocationData, {0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
633633
auto gfxAllocation = memoryManager.allocateGraphicsMemoryWithAlignment(allocationData);
634634
ASSERT_NE(gfxAllocation, nullptr);
635635
EXPECT_NE(gfxAllocation->getGpuBaseAddress(), 0ull);
@@ -647,7 +647,7 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenAskedForNon32BitAllocationWh
647647
memoryManager.forceLimitedRangeAllocator(0, 0xFFFFFFFFF);
648648

649649
AllocationData allocationData;
650-
MockMemoryManager::getAllocationData(allocationData, {0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
650+
memoryManager.getAllocationData(allocationData, {0, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER}, nullptr, StorageInfo{});
651651
auto gfxAllocation = memoryManager.allocateGraphicsMemoryWithAlignment(allocationData);
652652
ASSERT_NE(gfxAllocation, nullptr);
653653
EXPECT_EQ(gfxAllocation->getGpuBaseAddress(), 0ull);
@@ -1827,7 +1827,7 @@ TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllo
18271827
MockMemoryManager mockMemoryManager;
18281828
for (auto allocationType : allocationTypesThatMayNeedL3Flush) {
18291829
properties.allocationType = allocationType;
1830-
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
1830+
mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
18311831
EXPECT_TRUE(allocData.flags.flushL3);
18321832
}
18331833

@@ -1836,7 +1836,7 @@ TEST(MemoryManagerTest, givenAllocationTypesThatMayNeedL3FlushWhenCallingGetAllo
18361836

18371837
for (auto allocationType : allocationTypesThatMayNeedL3Flush) {
18381838
properties.allocationType = allocationType;
1839-
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
1839+
mockMemoryManager.getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
18401840
EXPECT_FALSE(allocData.flags.flushL3);
18411841
}
18421842
}

shared/source/memory_manager/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(NEO_CORE_MEMORY_MANAGER
3232
${CMAKE_CURRENT_SOURCE_DIR}/local_memory_usage.h
3333
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager.cpp
3434
${CMAKE_CURRENT_SOURCE_DIR}/memory_manager.h
35+
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/memory_manager_extra.cpp
3536
${CMAKE_CURRENT_SOURCE_DIR}/memory_operations_handler.h
3637
${CMAKE_CURRENT_SOURCE_DIR}/memory_operations_status.h
3738
${CMAKE_CURRENT_SOURCE_DIR}/memory_pool.h

shared/source/memory_manager/memory_manager.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
295295
case GraphicsAllocation::AllocationType::TAG_BUFFER:
296296
case GraphicsAllocation::AllocationType::GLOBAL_FENCE:
297297
case GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY:
298+
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
298299
allocationData.flags.useSystemMemory = true;
299300
default:
300301
break;
@@ -347,6 +348,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
347348

348349
allocationData.rootDeviceIndex = properties.rootDeviceIndex;
349350

351+
getAllocationDataExtra(allocationData, properties);
350352
return true;
351353
}
352354

shared/source/memory_manager/memory_manager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ class MemoryManager {
197197
uint32_t rootDeviceIndex = 0;
198198
};
199199

200-
static bool getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const void *hostPtr, const StorageInfo &storageInfo);
200+
bool getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const void *hostPtr, const StorageInfo &storageInfo);
201+
void getAllocationDataExtra(AllocationData &allocationData, const AllocationProperties &properties);
201202
static void overrideAllocationData(AllocationData &allocationData, const AllocationProperties &properties);
202203
static bool useInternal32BitAllocator(GraphicsAllocation::AllocationType allocationType) {
203204
return allocationType == GraphicsAllocation::AllocationType::KERNEL_ISA ||
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (C) 2020 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/memory_manager/memory_manager.h"
9+
10+
namespace NEO {
11+
void MemoryManager::getAllocationDataExtra(AllocationData &allocationData, const AllocationProperties &properties) {
12+
}
13+
14+
} // namespace NEO

0 commit comments

Comments
 (0)