refactor: merge memory properties into single header

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2025-12-15 13:17:06 +00:00
committed by Compute-Runtime-Automation
parent 2b02e49c87
commit a551807480
17 changed files with 37 additions and 69 deletions

View File

@@ -934,7 +934,6 @@ else()
endif()
endif()
include_directories(${NEO_SHARED_DIRECTORY}/helpers/definitions${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/memory_properties${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/release_helper/definitions${BRANCH_DIR_SUFFIX})
include_directories(${NEO_SHARED_DIRECTORY}/sku_info/definitions${BRANCH_DIR_SUFFIX})

View File

@@ -12,6 +12,7 @@
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/cache_policy.h"
#include "shared/source/helpers/hw_mapper.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/kernel/kernel_arg_descriptor.h"
#include "shared/source/memory_manager/graphics_allocation.h"
@@ -26,7 +27,6 @@
#include "level_zero/core/source/module/module.h"
#include "encode_surface_state_args.h"
#include "memory_properties_flags.h"
#include <cstdarg>
#include <vector>

View File

@@ -1,17 +1,17 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "opencl/extensions/public/cl_ext_private.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
#include "CL/cl_ext.h"
#include "memory_properties_flags.h"
namespace NEO {

View File

@@ -7,11 +7,11 @@
#pragma once
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "opencl/extensions/public/cl_ext_private.h"
#include "opencl/source/mem_obj/mem_obj.h"
#include "memory_properties_flags.h"
#include "neo_igfxfmid.h"
#include <functional>

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "opencl/extensions/public/cl_ext_private.h"
@@ -15,8 +16,6 @@
#include "opencl/source/helpers/destructor_callbacks.h"
#include "opencl/source/helpers/properties_helper.h"
#include "memory_properties_flags.h"
#include <cstdint>
#include <vector>

View File

@@ -8,13 +8,13 @@
#pragma once
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/memory_manager/unified_memory_manager.h"
#include "opencl/extensions/public/cl_ext_private.h"
#include "CL/cl.h"
#include "memory_properties_flags.h"
namespace NEO {

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/helpers/memory_properties_helpers.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
@@ -20,7 +21,6 @@
#include "CL/cl_ext.h"
#include "gtest/gtest.h"
#include "memory_properties_flags.h"
using namespace NEO;

View File

@@ -9,6 +9,7 @@
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/helpers/surface_format_info.h"
#include "shared/source/image/image_surface_state.h"
#include "shared/source/memory_manager/graphics_allocation.h"
@@ -39,7 +40,6 @@
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "CL/cl.h"
#include "memory_properties_flags.h"
namespace NEO {
template <typename GfxFamily>

View File

@@ -7,12 +7,11 @@
#pragma once
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "opencl/source/mem_obj/image.h"
#include "memory_properties_flags.h"
namespace NEO {
struct MockImageBase : public Image {

View File

@@ -114,6 +114,7 @@ set(NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/local_id_gen_sse4.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_work_size.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_base.inl

View File

@@ -5,9 +5,13 @@
*
*/
#pragma once
#include <cstdint>
#include <vector>
namespace NEO {
class Device;
struct MemoryFlags {
uint32_t readWrite : 1;
uint32_t writeOnly : 1;
@@ -41,4 +45,21 @@ struct MemoryAllocFlags {
uint32_t usmInitialPlacementGpu : 1;
};
struct MemoryProperties {
uint64_t handle = 0;
uint64_t handleType = 0;
uintptr_t hostptr = 0;
const Device *pDevice = nullptr;
std::vector<Device *> associatedDevices;
uint32_t memCacheClos = 0;
union {
MemoryFlags flags;
uint32_t allFlags = 0;
};
union {
MemoryAllocFlags allocFlags;
uint32_t allAllocFlags = 0;
};
static_assert(sizeof(MemoryProperties::flags) == sizeof(MemoryProperties::allFlags) && sizeof(MemoryProperties::allocFlags) == sizeof(MemoryProperties::allAllocFlags), "");
};
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -8,11 +8,10 @@
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/device/device.h"
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/helpers/memory_properties_helpers.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "memory_properties_flags.h"
namespace NEO {
AllocationProperties MemoryPropertiesHelper::getAllocationProperties(

View File

@@ -14,6 +14,7 @@
#include "shared/source/helpers/engine_control.h"
#include "shared/source/helpers/engine_node_helper.h"
#include "shared/source/helpers/heap_assigner.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/memory_manager/address_range.h"
#include "shared/source/memory_manager/alignment_selector.h"
#include "shared/source/memory_manager/definitions/storage_info.h"
@@ -25,8 +26,6 @@
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/utilities/stackvec.h"
#include "memory_properties_flags.h"
#include <atomic>
#include <cstdint>
#include <functional>

View File

@@ -10,6 +10,7 @@
#include "shared/source/helpers/common_types.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/device_bitfield.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/memory_manager/memadvise_flags.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
@@ -18,8 +19,6 @@
#include "shared/source/utilities/sorted_vector.h"
#include "shared/source/utilities/spinlock.h"
#include "memory_properties_flags.h"
#include <atomic>
#include <chrono>
#include <cstdint>

View File

@@ -7,12 +7,11 @@
#pragma once
#include "shared/source/helpers/device_bitfield.h"
#include "shared/source/helpers/memory_properties_flags.h"
#include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/unified_memory/unified_memory.h"
#include "shared/source/utilities/stackvec.h"
#include "memory_properties_flags.h"
#include <cstdint>
#include <map>

View File

@@ -1,14 +0,0 @@
#
# Copyright (C) 2019-2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set(NEO_CORE_MEMORY_PROPERTIES
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}memory_properties_flags.h
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_flags_common.inl
)
set_property(GLOBAL PROPERTY NEO_CORE_MEMORY_PROPERTIES ${NEO_CORE_MEMORY_PROPERTIES})
add_subdirectories()

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/memory_properties/memory_properties_flags_common.inl"
#include <vector>
namespace NEO {
class Device;
struct MemoryProperties {
uint64_t handle = 0;
uint64_t handleType = 0;
uintptr_t hostptr = 0;
const Device *pDevice = nullptr;
std::vector<Device *> associatedDevices;
uint32_t memCacheClos = 0;
union {
MemoryFlags flags;
uint32_t allFlags = 0;
};
union {
MemoryAllocFlags allocFlags;
uint32_t allAllocFlags = 0;
};
static_assert(sizeof(MemoryProperties::flags) == sizeof(MemoryProperties::allFlags) && sizeof(MemoryProperties::allocFlags) == sizeof(MemoryProperties::allAllocFlags), "");
};
} // namespace NEO