mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 22:08:53 +08:00
Move MemoryProperties struct to separate file
Change-Id: Ie35d2638b6fe5cafe64f3b9fc3e0c3b67ac08fd7 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
d0ef355a35
commit
622f71a1b2
@@ -551,6 +551,7 @@ include_directories(${IGDRCL_SOURCE_DIR}/runtime/gen_common/reg_configs${BRANCH_
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/client_context${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/gmm_helper/gmm_memory${BRANCH_DIR_SUFFIX})
|
||||
include_directories(${IGDRCL_SOURCE_DIR}/runtime/mem_obj/definitions${BRANCH_DIR_SUFFIX})
|
||||
|
||||
set(HW_SRC_INCLUDE_PATH ${IGDRCL_SOURCE_DIR}/runtime/gen_common)
|
||||
|
||||
|
||||
@@ -43,11 +43,6 @@
|
||||
using cl_mem_properties_intel = cl_bitfield;
|
||||
using cl_mem_flags_intel = cl_mem_flags;
|
||||
|
||||
struct MemoryProperties {
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flags_intel = 0;
|
||||
};
|
||||
|
||||
/******************************
|
||||
* Internal only cl_mem_flags *
|
||||
******************************/
|
||||
|
||||
@@ -18,6 +18,8 @@ set(RUNTIME_SRCS_MEM_OBJ
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/map_operations_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mem_obj.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mem_obj.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}/mem_obj_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/definitions/mem_obj_types_common.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/mem_obj_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mem_obj_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pipe.cpp
|
||||
|
||||
@@ -195,8 +195,8 @@ Buffer *Buffer::create(Context *context,
|
||||
}
|
||||
|
||||
if (!memory) {
|
||||
AllocationFlags allocFlags = MemObjHelper::getAllocationFlags(properties.flags, allocateMemory);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties.flags_intel);
|
||||
AllocationFlags allocFlags = MemObjHelper::getAllocationFlags(properties.flags_intel, allocateMemory);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocFlags, devices, hostPtr, static_cast<size_t>(size), allocationType);
|
||||
}
|
||||
|
||||
@@ -210,8 +210,8 @@ Buffer *Buffer::create(Context *context,
|
||||
allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
|
||||
zeroCopyAllowed = false;
|
||||
copyMemoryFromHostPtr = true;
|
||||
AllocationFlags allocFlags = MemObjHelper::getAllocationFlags(properties.flags, true);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties.flags_intel);
|
||||
AllocationFlags allocFlags = MemObjHelper::getAllocationFlags(properties.flags_intel, true);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(properties);
|
||||
memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocFlags, devices, nullptr, static_cast<size_t>(size), allocationType);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace OCLRT {
|
||||
class Buffer;
|
||||
class Device;
|
||||
class MemoryManager;
|
||||
struct MemoryProperties;
|
||||
|
||||
typedef Buffer *(*BufferCreatFunc)(Context *context,
|
||||
cl_mem_flags flags,
|
||||
|
||||
16
runtime/mem_obj/definitions/mem_obj_types.h
Normal file
16
runtime/mem_obj/definitions/mem_obj_types.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/mem_obj/definitions/mem_obj_types_common.inl"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
struct MemoryProperties : MemoryPropertiesBase {
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
||||
17
runtime/mem_obj/definitions/mem_obj_types_common.inl
Normal file
17
runtime/mem_obj/definitions/mem_obj_types_common.inl
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "public/cl_ext_private.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
struct MemoryPropertiesBase {
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flags_intel = 0;
|
||||
};
|
||||
|
||||
} // namespace OCLRT
|
||||
@@ -33,11 +33,11 @@ bool MemObjHelper::validateExtraMemoryProperties(const MemoryProperties &propert
|
||||
return true;
|
||||
}
|
||||
|
||||
AllocationFlags MemObjHelper::getAllocationFlags(cl_mem_flags flags, bool allocateMemory) {
|
||||
AllocationFlags MemObjHelper::getAllocationFlags(cl_mem_flags_intel flags, bool allocateMemory) {
|
||||
return AllocationFlags(allocateMemory);
|
||||
}
|
||||
|
||||
DevicesBitfield MemObjHelper::getDevicesBitfield(cl_mem_flags flags) {
|
||||
DevicesBitfield MemObjHelper::getDevicesBitfield(const MemoryProperties &properties) {
|
||||
return DevicesBitfield(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "CL/cl.h"
|
||||
#include "mem_obj_types.h"
|
||||
#include "public/cl_ext_private.h"
|
||||
#include "runtime/mem_obj/mem_obj.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
@@ -49,9 +50,9 @@ class MemObjHelper {
|
||||
|
||||
static bool validateExtraMemoryProperties(const MemoryProperties &properties);
|
||||
|
||||
static AllocationFlags getAllocationFlags(cl_mem_flags flags, bool allocateMemory);
|
||||
static AllocationFlags getAllocationFlags(cl_mem_flags_intel flags, bool allocateMemory);
|
||||
|
||||
static DevicesBitfield getDevicesBitfield(cl_mem_flags flags);
|
||||
static DevicesBitfield getDevicesBitfield(const MemoryProperties &properties);
|
||||
|
||||
static bool checkMemFlagsForSubBuffer(cl_mem_flags flags) {
|
||||
const cl_mem_flags allValidFlags =
|
||||
|
||||
@@ -47,9 +47,11 @@ Pipe *Pipe::create(Context *context,
|
||||
MemoryManager *memoryManager = context->getMemoryManager();
|
||||
DEBUG_BREAK_IF(!memoryManager);
|
||||
|
||||
MemoryProperties memoryProperties;
|
||||
memoryProperties.flags = flags;
|
||||
while (true) {
|
||||
AllocationFlags allocFlags = MemObjHelper::getAllocationFlags(flags, true);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(flags);
|
||||
DevicesBitfield devices = MemObjHelper::getDevicesBitfield(memoryProperties);
|
||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||
GraphicsAllocation *memory = memoryManager->allocateGraphicsMemoryInPreferredPool(allocFlags, devices, nullptr, size, GraphicsAllocation::AllocationType::PIPE);
|
||||
if (!memory) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "runtime/helpers/array_count.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "mem_obj_types.h"
|
||||
#include "runtime/memory_manager/svm_memory_manager.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
|
||||
Reference in New Issue
Block a user