Cleanup includes 31

Cleaned up files:
shared/source/command_stream/experimental_command_buffer.h
shared/source/helpers/get_info.h
shared/source/helpers/local_id_gen.h
shared/source/memory_manager/gfx_partition.h
shared/source/memory_manager/host_ptr_manager.h
shared/source/memory_manager/prefetch_manager.h
shared/test/common/mocks/mock_memory_manager.h

Related-To: NEO-5548
Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
Warchulski, Jaroslaw
2023-01-13 15:18:40 +00:00
committed by Compute-Runtime-Automation
parent 50b8069d41
commit 8de3898abc
52 changed files with 180 additions and 98 deletions

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/built_ins/sip.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/test.h"

View File

@@ -7,6 +7,7 @@
#include "shared/source/built_ins/sip.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_compilers.h"

View File

@@ -12,6 +12,7 @@
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_operations_status.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/test_files.h"
#include "shared/test/common/mocks/mock_compilers.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/pipe_control_args.h"
#include "shared/source/memory_manager/graphics_allocation.h"

View File

@@ -8,6 +8,7 @@
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/local_memory_access_modes.h"
#include "shared/source/memory_manager/memory_allocation.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"

View File

@@ -17,6 +17,7 @@
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/mock_ostime.h"
#include "shared/test/common/test_macros/test.h"

View File

@@ -5,7 +5,9 @@
*
*/
#include "shared/source/helpers/aligned_memory.h"
#include "shared/test/common/fixtures/memory_management_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/test.h"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/utilities/heap_allocator.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/hw_test.h"

View File

@@ -20,6 +20,7 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/mocks/mock_hw_helper.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/hw_test.h"

View File

@@ -7,6 +7,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_memory_manager.h"

View File

@@ -7,6 +7,7 @@
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/memory_manager/memory_pool.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_memory_manager.h"

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/wait_status.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/allocations_list.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/source/os_interface/os_context.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/ult_device_factory.h"

View File

@@ -11,6 +11,7 @@
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/host_ptr_manager.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/memory_banks.h"
#include "shared/source/memory_manager/residency.h"
@@ -38,6 +39,7 @@
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_gmm_page_table_mngr.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/common/test_macros/hw_test.h"

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/memory_manager/migration_sync_data.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"

View File

@@ -12,6 +12,7 @@
#include "shared/source/compiler_interface/external_functions.h"
#include "shared/source/memory_manager/deferred_deleter.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/mocks/mock_svm_manager.h"

View File

@@ -8,6 +8,7 @@
#include "opencl/test/unit_test/mocks/ult_cl_device_factory.h"
#include "shared/source/command_stream/create_command_stream_impl.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/mocks/mock_memory_manager.h"

View File

@@ -14,6 +14,7 @@
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/os_library.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/mock_execution_environment.h"

View File

@@ -11,6 +11,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/array_count.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/os_library.h"

View File

@@ -1,13 +1,13 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cstdint>
#include <memory>
#include <stdint.h>
namespace NEO {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,7 +11,6 @@
// Need for linux compatibility with memcpy_s
#include "shared/source/helpers/string.h"
#include <cstring>
#include <limits>
namespace GetInfo {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,10 +7,8 @@
#pragma once
#include "shared/source/helpers/ptr_math.h"
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
namespace NEO {

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/local_id_gen.h"
#include "shared/source/helpers/ptr_math.h"
#include <array>

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/hw_walk_order.h"
#include "shared/source/helpers/per_thread_data.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/helpers/string.h"
#include "shared/source/helpers/vec.h"
#include "shared/source/kernel/implicit_args.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -12,6 +12,7 @@
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/utilities/cpu_info.h"
#include "shared/source/utilities/heap_allocator.h"
namespace NEO {
@@ -134,6 +135,18 @@ void GfxPartition::Heap::initFrontWindow(uint64_t base, uint64_t size) {
alloc = std::make_unique<HeapAllocator>(base, size, MemoryConstants::pageSize, 0u);
}
uint64_t GfxPartition::Heap::allocate(size_t &size) {
return alloc->allocate(size);
}
uint64_t GfxPartition::Heap::allocateWithCustomAlignment(size_t &sizeToAllocate, size_t alignment) {
return alloc->allocateWithCustomAlignment(sizeToAllocate, alignment);
}
void GfxPartition::Heap::free(uint64_t ptr, size_t size) {
alloc->free(ptr, size);
}
void GfxPartition::freeGpuAddressRange(uint64_t ptr, size_t size) {
for (auto heapName : GfxPartition::heapNonSvmNames) {
auto &heap = getHeap(heapName);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 Intel Corporation
* Copyright (C) 2019-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,11 +8,11 @@
#pragma once
#include "shared/source/helpers/constants.h"
#include "shared/source/os_interface/os_memory.h"
#include "shared/source/utilities/heap_allocator.h"
#include <array>
namespace NEO {
class HeapAllocator;
enum class HeapIndex : uint32_t {
HEAP_INTERNAL_DEVICE_MEMORY = 0u,
@@ -110,9 +110,9 @@ class GfxPartition {
uint64_t getBase() const { return base; }
uint64_t getSize() const { return size; }
uint64_t getLimit() const { return size ? base + size - 1 : 0; }
uint64_t allocate(size_t &size) { return alloc->allocate(size); }
uint64_t allocateWithCustomAlignment(size_t &sizeToAllocate, size_t alignment) { return alloc->allocateWithCustomAlignment(sizeToAllocate, alignment); }
void free(uint64_t ptr, size_t size) { alloc->free(ptr, size); }
uint64_t allocate(size_t &size);
uint64_t allocateWithCustomAlignment(size_t &sizeToAllocate, size_t alignment);
void free(uint64_t ptr, size_t size);
protected:
uint64_t base = 0, size = 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,14 +30,6 @@ enum class FragmentPosition {
TRAILING
};
enum OverlapStatus {
FRAGMENT_NOT_OVERLAPING_WITH_ANY_OTHER = 0,
FRAGMENT_WITHIN_STORED_FRAGMENT,
FRAGMENT_WITH_EXACT_SIZE_AS_STORED_FRAGMENT,
FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT,
FRAGMENT_NOT_CHECKED
};
enum class RequirementsStatus {
SUCCESS = 0,
FATAL

View File

@@ -1,17 +1,28 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/memory_manager/host_ptr_defines.h"
#include <map>
#include <mutex>
namespace NEO {
struct AllocationRequirements;
struct AllocationStorageData;
struct OsHandleStorage;
struct FragmentStorage;
enum class RequirementsStatus;
enum OverlapStatus {
FRAGMENT_NOT_OVERLAPING_WITH_ANY_OTHER = 0,
FRAGMENT_WITHIN_STORED_FRAGMENT,
FRAGMENT_WITH_EXACT_SIZE_AS_STORED_FRAGMENT,
FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT,
FRAGMENT_NOT_CHECKED
};
struct HostPtrEntryKey {
const void *ptr = nullptr;

View File

@@ -32,6 +32,7 @@
#include "shared/source/memory_manager/host_ptr_manager.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/local_memory_usage.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "shared/source/memory_manager/prefetch_manager.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/os_context.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,13 +8,13 @@
#pragma once
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/source/utilities/spinlock.h"
#include <memory>
#include <vector>
namespace NEO {
struct SvmAllocationData;
class CommandStreamReceiver;
class Device;

View File

@@ -10,6 +10,7 @@
#include "shared/source/command_stream/preemption.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/mocks/mock_csr.h"
#include "shared/test/common/mocks/mock_memory_manager.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/os_interface/linux/allocator_helper.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"

View File

@@ -9,6 +9,8 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/fixtures/mock_aub_center_fixture.h"
#include "shared/test/common/mocks/mock_execution_environment.h"

View File

@@ -9,14 +9,32 @@
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/surface_format_info.h"
#include "shared/source/memory_manager/deferred_deleter.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include <cstring>
namespace NEO {
MockMemoryManager::MockMemoryManager(bool enableLocalMemory, ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(false, enableLocalMemory, executionEnvironment) {
hostPtrManager.reset(new MockHostPtrManager);
}
MockMemoryManager::MockMemoryManager() : MockMemoryManager(*(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(static_cast<MockExecutionEnvironment *>(&executionEnvironment));
mockExecutionEnvironment->initGmm();
}
MockMemoryManager::MockMemoryManager(bool enable64pages, bool enableLocalMemory) : MemoryManagerCreate(enable64pages, enableLocalMemory, *(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(static_cast<MockExecutionEnvironment *>(&executionEnvironment));
}
void MockMemoryManager::setDeferredDeleter(DeferredDeleter *deleter) {
deferredDeleter.reset(deleter);
}
@@ -40,6 +58,14 @@ void *MockMemoryManager::allocateSystemMemory(size_t size, size_t alignment) {
return OsAgnosticMemoryManager::allocateSystemMemory(redundancyRatio * size, alignment);
}
void MockMemoryManager::waitForEnginesCompletion(GraphicsAllocation &graphicsAllocation) {
waitForEnginesCompletionCalled++;
if (waitAllocations.get()) {
waitAllocations->addAllocation(&graphicsAllocation);
}
MemoryManager::waitForEnginesCompletion(graphicsAllocation);
}
GraphicsAllocation *MockMemoryManager::allocateGraphicsMemoryWithProperties(const AllocationProperties &properties) {
if (isMockHostMemoryManager) {
allocateGraphicsMemoryWithPropertiesCount++;
@@ -150,6 +176,17 @@ GraphicsAllocation *MockMemoryManager::allocate32BitGraphicsMemoryImpl(const All
return OsAgnosticMemoryManager::allocate32BitGraphicsMemoryImpl(allocationData, useLocalMemory);
}
void MockMemoryManager::forceLimitedRangeAllocator(uint32_t rootDeviceIndex, uint64_t range) {
getGfxPartition(rootDeviceIndex)->init(range, 0, 0, gfxPartitions.size());
}
bool MockMemoryManager::isKmdMigrationAvailable(uint32_t rootDeviceIndex) {
if (DebugManager.flags.UseKmdMigration.get() != -1) {
return !!DebugManager.flags.UseKmdMigration.get();
}
return false;
}
GraphicsAllocation *MockMemoryManager::createGraphicsAllocationFromExistingStorage(AllocationProperties &properties, void *ptr, MultiGraphicsAllocation &multiGraphicsAllocation) {
auto allocation = OsAgnosticMemoryManager::createGraphicsAllocationFromExistingStorage(properties, ptr, multiGraphicsAllocation);
createGraphicsAllocationFromExistingStorageCalled++;
@@ -188,6 +225,12 @@ bool MockMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphics
return OsAgnosticMemoryManager::copyMemoryToAllocationBanks(graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy, handleMask);
};
void *MockAllocSysMemAgnosticMemoryManager::allocateSystemMemory(size_t size, size_t alignment) {
constexpr size_t minAlignment = 16;
alignment = std::max(alignment, minAlignment);
return alignedMalloc(size, alignment);
}
FailMemoryManager::FailMemoryManager(int32_t failedAllocationsCount, ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {
this->failedAllocationsCount = failedAllocationsCount;
}
@@ -197,4 +240,30 @@ FailMemoryManager::FailMemoryManager(int32_t failedAllocationsCount, ExecutionEn
this->failedAllocationsCount = failedAllocationsCount;
}
GraphicsAllocation *MockMemoryManagerFailFirstAllocation::allocateNonSystemGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) {
auto allocation = baseAllocateGraphicsMemoryInDevicePool(allocationData, status);
if (!allocation) {
allocation = allocateGraphicsMemory(allocationData);
}
static_cast<MemoryAllocation *>(allocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
return allocation;
}
OsContext *MockMemoryManagerOsAgnosticContext::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
const EngineDescriptor &engineDescriptor) {
auto osContext = new OsContext(commandStreamReceiver->getRootDeviceIndex(), 0, engineDescriptor);
osContext->incRefInternal();
registeredEngines.emplace_back(commandStreamReceiver, osContext);
return osContext;
}
OsContext *MockMemoryManagerWithDebuggableOsContext::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
const EngineDescriptor &engineDescriptor) {
auto osContext = new MockOsContext(0, engineDescriptor);
osContext->debuggableContext = true;
osContext->incRefInternal();
registeredEngines.emplace_back(commandStreamReceiver, osContext);
return osContext;
}
} // namespace NEO

View File

@@ -6,18 +6,11 @@
*/
#pragma once
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/memory_manager/memory_allocation.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/common/test_macros/mock_method_macros.h"
namespace NEO {
@@ -65,17 +58,9 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
MockMemoryManager(ExecutionEnvironment &executionEnvironment) : MockMemoryManager(false, executionEnvironment) {}
MockMemoryManager(bool enableLocalMemory, ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(false, enableLocalMemory, executionEnvironment) {
hostPtrManager.reset(new MockHostPtrManager);
};
MockMemoryManager() : MockMemoryManager(*(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(static_cast<MockExecutionEnvironment *>(&executionEnvironment));
mockExecutionEnvironment->initGmm();
};
MockMemoryManager(bool enable64pages, bool enableLocalMemory) : MemoryManagerCreate(enable64pages, enableLocalMemory, *(new MockExecutionEnvironment(defaultHwInfo.get()))) {
mockExecutionEnvironment.reset(static_cast<MockExecutionEnvironment *>(&executionEnvironment));
}
MockMemoryManager(bool enableLocalMemory, ExecutionEnvironment &executionEnvironment);
MockMemoryManager();
MockMemoryManager(bool enable64pages, bool enableLocalMemory);
ADDMETHOD_NOBASE(registerSysMemAlloc, AllocationStatus, AllocationStatus::Success, (GraphicsAllocation * allocation));
ADDMETHOD_NOBASE(registerLocalMemAlloc, AllocationStatus, AllocationStatus::Success, (GraphicsAllocation * allocation, uint32_t rootDeviceIndex));
@@ -122,13 +107,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
return false;
}
void waitForEnginesCompletion(GraphicsAllocation &graphicsAllocation) override {
waitForEnginesCompletionCalled++;
if (waitAllocations.get()) {
waitAllocations->addAllocation(&graphicsAllocation);
}
MemoryManager::waitForEnginesCompletion(graphicsAllocation);
}
void waitForEnginesCompletion(GraphicsAllocation &graphicsAllocation) override;
void handleFenceCompletion(GraphicsAllocation *graphicsAllocation) override {
handleFenceCompletionCalled++;
@@ -159,7 +138,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
bool isLimitedGPU(uint32_t rootDeviceIndex) override {
return limitedGPU;
}
void forceLimitedRangeAllocator(uint32_t rootDeviceIndex, uint64_t range) { getGfxPartition(rootDeviceIndex)->init(range, 0, 0, gfxPartitions.size()); }
void forceLimitedRangeAllocator(uint32_t rootDeviceIndex, uint64_t range);
bool setMemAdvise(GraphicsAllocation *gfxAllocation, MemAdviseFlags flags, uint32_t rootDeviceIndex) override {
memAdviseFlags = flags;
@@ -175,12 +154,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
return MemoryManager::setMemPrefetch(gfxAllocation, subDeviceIds, rootDeviceIndex);
}
bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) override {
if (DebugManager.flags.UseKmdMigration.get() != -1) {
return !!DebugManager.flags.UseKmdMigration.get();
}
return false;
}
bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) override;
struct CopyMemoryToAllocationBanksParams {
GraphicsAllocation *graphicsAllocation = nullptr;
@@ -291,11 +265,7 @@ class MockAllocSysMemAgnosticMemoryManager : public OsAgnosticMemoryManager {
return ptrRestrictions;
}
void *allocateSystemMemory(size_t size, size_t alignment) override {
constexpr size_t minAlignment = 16;
alignment = std::max(alignment, minAlignment);
return alignedMalloc(size, alignment);
}
void *allocateSystemMemory(size_t size, size_t alignment) override;
AlignedMallocRestrictions testRestrictions;
AlignedMallocRestrictions *ptrRestrictions;
@@ -393,39 +363,22 @@ class MockMemoryManagerFailFirstAllocation : public MockMemoryManager {
GraphicsAllocation *baseAllocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) {
return OsAgnosticMemoryManager::allocateGraphicsMemoryInDevicePool(allocationData, status);
}
GraphicsAllocation *allocateNonSystemGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) {
auto allocation = baseAllocateGraphicsMemoryInDevicePool(allocationData, status);
if (!allocation) {
allocation = allocateGraphicsMemory(allocationData);
}
static_cast<MemoryAllocation *>(allocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
return allocation;
}
GraphicsAllocation *allocateNonSystemGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status);
};
class MockMemoryManagerOsAgnosticContext : public MockMemoryManager {
public:
MockMemoryManagerOsAgnosticContext(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
const EngineDescriptor &engineDescriptor) override {
auto osContext = new OsContext(commandStreamReceiver->getRootDeviceIndex(), 0, engineDescriptor);
osContext->incRefInternal();
registeredEngines.emplace_back(commandStreamReceiver, osContext);
return osContext;
}
const EngineDescriptor &engineDescriptor) override;
};
class MockMemoryManagerWithDebuggableOsContext : public MockMemoryManager {
public:
MockMemoryManagerWithDebuggableOsContext(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
const EngineDescriptor &engineDescriptor) override {
auto osContext = new MockOsContext(0, engineDescriptor);
osContext->debuggableContext = true;
osContext->incRefInternal();
registeredEngines.emplace_back(commandStreamReceiver, osContext);
return osContext;
}
const EngineDescriptor &engineDescriptor) override;
};
class MockMemoryManagerWithCapacity : public MockMemoryManager {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -9,6 +9,7 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/test/common/fixtures/cpu_page_fault_manager_tests_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
namespace NEO {

View File

@@ -8,6 +8,7 @@
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/variable_backup.h"

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#include "shared/test/unit_test/fixtures/front_window_fixture.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,7 @@
#include "shared/source/helpers/bindless_heaps_helper.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_bindless_heaps_helper.h"
#include "shared/test/common/mocks/mock_device.h"

View File

@@ -7,6 +7,7 @@
#include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/helpers/timestamp_packet.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/source/utilities/tag_allocator.h"
#include "shared/test/common/cmd_parse/hw_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"

View File

@@ -8,6 +8,7 @@
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/hw_walk_order.h"
#include "shared/source/helpers/per_thread_data.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/kernel/implicit_args.h"
#include "shared/source/kernel/kernel_descriptor.h"
#include "shared/test/common/helpers/default_hw_info.h"

View File

@@ -10,6 +10,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/memory_properties_helpers.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/memory_manager/local_memory_usage.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_device.h"

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_memory_manager.h"
#include "shared/test/common/test_macros/test.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,6 +8,7 @@
#include "shared/source/command_stream/preemption.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/mocks/mock_cpu_page_fault_manager.h"
#include "shared/test/common/mocks/mock_csr.h"

View File

@@ -13,6 +13,7 @@
#include "shared/source/memory_manager/memory_banks.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "shared/source/os_interface/linux/allocator_helper.h"
#include "shared/source/utilities/heap_allocator.h"
#include "shared/test/common/helpers/batch_buffer_helper.h"
#include "shared/test/common/libult/linux/drm_mock_helper.h"
#include "shared/test/common/libult/linux/drm_mock_prelim_context.h"

View File

@@ -8,6 +8,7 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/heap_assigner.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/memory_manager/memory_banks.h"
#include "shared/source/os_interface/linux/allocator_helper.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
@@ -15,6 +16,7 @@
#include "shared/source/os_interface/linux/drm_memory_manager.h"
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/utilities/heap_allocator.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/helpers/variable_backup.h"

View File

@@ -10,6 +10,7 @@
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/surface_format_info.h"
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/source/memory_manager/host_ptr_manager.h"
#include "shared/source/memory_manager/memory_banks.h"
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
#include "shared/source/os_interface/linux/i915.h"
@@ -26,6 +27,7 @@
#include "shared/test/common/mocks/mock_gfx_partition.h"
#include "shared/test/common/mocks/mock_gmm.h"
#include "shared/test/common/mocks/mock_gmm_client_context_base.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/os_interface/linux/drm_memory_manager_fixture.h"
#include "shared/test/common/os_interface/linux/drm_mock_cache_info.h"
#include "shared/test/common/test_macros/hw_test.h"

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"

View File

@@ -7,6 +7,7 @@
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/memory_manager/gfx_partition.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/fixtures/device_fixture.h"

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
* Copyright (C) 2021-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_memory_manager.h"