mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
Move core part of MemoryPropertiesHelpers to shared
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
afa45bd9e7
commit
48f01f28f5
@@ -33,8 +33,8 @@
|
||||
#include "opencl/source/event/user_event.h"
|
||||
#include "opencl/source/execution_environment/cl_execution_environment.h"
|
||||
#include "opencl/source/gtpin/gtpin_notify.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/get_info_status_mapper.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/queue_helpers.h"
|
||||
#include "opencl/source/helpers/validators.h"
|
||||
#include "opencl/source/kernel/kernel.h"
|
||||
@@ -1187,7 +1187,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context,
|
||||
auto pClDevice = pContext->getDevice(0);
|
||||
surfaceFormat = Image::getSurfaceFormatFromTable(memFlags, imageFormat,
|
||||
pClDevice->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
retVal = Image::validate(pContext, MemoryPropertiesHelper::createMemoryProperties(memFlags, 0, 0, &pClDevice->getDevice()),
|
||||
retVal = Image::validate(pContext, ClMemoryPropertiesHelper::createMemoryProperties(memFlags, 0, 0, &pClDevice->getDevice()),
|
||||
surfaceFormat, imageDesc, nullptr);
|
||||
}
|
||||
if (CL_SUCCESS == retVal) {
|
||||
@@ -3809,9 +3809,9 @@ void *clHostMemAllocINTEL(
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
if (!ClMemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
err.set(CL_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3851,9 +3851,9 @@ void *clDeviceMemAllocINTEL(
|
||||
cl_mem_flags flags = 0;
|
||||
cl_mem_flags_intel flagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
if (!ClMemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
err.set(CL_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -3905,9 +3905,9 @@ void *clSharedMemAllocINTEL(
|
||||
}
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::SHARED_UNIFIED_MEMORY, neoContext->getRootDeviceIndices(), subDeviceBitfields);
|
||||
unifiedMemoryProperties.device = unifiedMemoryPropertiesDevice;
|
||||
if (!MemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
if (!ClMemoryPropertiesHelper::parseMemoryProperties(properties, unifiedMemoryProperties.allocationFlags, flags, flagsIntel,
|
||||
allocflags, MemoryPropertiesHelper::ObjType::UNKNOWN,
|
||||
*neoContext)) {
|
||||
err.set(CL_INVALID_VALUE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_hw_helper_bdw_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}cl_memory_properties_helpers.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_memory_properties_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_memory_properties_helpers_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_preemption_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_preemption_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/convert_color.h
|
||||
@@ -34,9 +37,6 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper_bdw_and_later.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/helper_options.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_ocl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}memory_properties_helpers.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_properties_helpers_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/properties_helper.h
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,17 +7,17 @@
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers_base.inl"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers_base.inl"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
void MemoryPropertiesHelper::addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
|
||||
void ClMemoryPropertiesHelper::addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel) {
|
||||
}
|
||||
|
||||
bool MemoryPropertiesHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel,
|
||||
cl_mem_alloc_flags_intel &allocflags, ObjType objectType, Context &context) {
|
||||
bool ClMemoryPropertiesHelper::parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel,
|
||||
cl_mem_alloc_flags_intel &allocflags, MemoryPropertiesHelper::ObjType objectType, Context &context) {
|
||||
Device *pDevice = &context.getDevice(0)->getDevice();
|
||||
|
||||
if (properties != nullptr) {
|
||||
@@ -38,7 +38,7 @@ bool MemoryPropertiesHelper::parseMemoryProperties(const cl_mem_properties_intel
|
||||
}
|
||||
}
|
||||
|
||||
memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, allocflags, pDevice);
|
||||
memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, allocflags, pDevice);
|
||||
|
||||
switch (objectType) {
|
||||
case MemoryPropertiesHelper::ObjType::BUFFER:
|
||||
@@ -53,16 +53,4 @@ bool MemoryPropertiesHelper::parseMemoryProperties(const cl_mem_properties_intel
|
||||
return true;
|
||||
}
|
||||
|
||||
void MemoryPropertiesHelper::fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, bool deviceOnlyVisibilty) {
|
||||
fillCachePolicyInProperties(allocationProperties,
|
||||
memoryProperties.flags.locallyUncachedResource,
|
||||
memoryProperties.flags.readOnly,
|
||||
deviceOnlyVisibilty,
|
||||
0);
|
||||
}
|
||||
|
||||
uint32_t MemoryPropertiesHelper::getCacheRegion(const MemoryProperties &memoryProperties) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
27
opencl/source/helpers/cl_memory_properties_helpers.h
Normal file
27
opencl/source/helpers/cl_memory_properties_helpers.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/memory_properties_helpers.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class Context;
|
||||
|
||||
class ClMemoryPropertiesHelper {
|
||||
public:
|
||||
static void addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
|
||||
static MemoryProperties createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel,
|
||||
cl_mem_alloc_flags_intel allocflags, const Device *pDevice);
|
||||
|
||||
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags,
|
||||
MemoryPropertiesHelper::ObjType objectType, Context &context);
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -8,14 +8,14 @@
|
||||
#include "shared/source/helpers/bit_helpers.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
|
||||
#include "CL/cl_ext_intel.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
MemoryProperties MemoryPropertiesHelper::createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel,
|
||||
cl_mem_alloc_flags_intel allocflags, const Device *pDevice) {
|
||||
MemoryProperties ClMemoryPropertiesHelper::createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel,
|
||||
cl_mem_alloc_flags_intel allocflags, const Device *pDevice) {
|
||||
MemoryProperties memoryProperties;
|
||||
|
||||
if (isValueSet(flags, CL_MEM_READ_WRITE)) {
|
||||
@@ -91,33 +91,4 @@ MemoryProperties MemoryPropertiesHelper::createMemoryProperties(cl_mem_flags fla
|
||||
|
||||
return memoryProperties;
|
||||
}
|
||||
|
||||
AllocationProperties MemoryPropertiesHelper::getAllocationProperties(
|
||||
uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
|
||||
GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
||||
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty) {
|
||||
|
||||
auto deviceBitfield = adjustDeviceBitfield(rootDeviceIndex, memoryProperties, subDevicesBitfieldParam);
|
||||
AllocationProperties allocationProperties(rootDeviceIndex, allocateMemory, size, type, multiStorageResource, deviceBitfield);
|
||||
fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo, deviceOnlyVisibilty);
|
||||
return allocationProperties;
|
||||
}
|
||||
|
||||
void MemoryPropertiesHelper::fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
|
||||
bool deviceOnlyVisibilty, uint32_t cacheRegion) {
|
||||
allocationProperties.flags.uncacheable = uncached;
|
||||
auto cacheFlushRequired = !uncached && !readOnly && !deviceOnlyVisibilty;
|
||||
allocationProperties.flags.flushL3RequiredForRead = cacheFlushRequired;
|
||||
allocationProperties.flags.flushL3RequiredForWrite = cacheFlushRequired;
|
||||
allocationProperties.cacheRegion = cacheRegion;
|
||||
}
|
||||
|
||||
DeviceBitfield MemoryPropertiesHelper::adjustDeviceBitfield(uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties,
|
||||
DeviceBitfield deviceBitfieldIn) {
|
||||
if (rootDeviceIndex == memoryProperties.pDevice->getRootDeviceIndex()) {
|
||||
return deviceBitfieldIn & memoryProperties.pDevice->getDeviceBitfield();
|
||||
}
|
||||
return deviceBitfieldIn;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/bit_helpers.h"
|
||||
#include "shared/source/memory_manager/allocation_properties.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
|
||||
#include "memory_properties_flags.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class Context;
|
||||
|
||||
class MemoryPropertiesHelper {
|
||||
public:
|
||||
enum class ObjType {
|
||||
UNKNOWN,
|
||||
BUFFER,
|
||||
IMAGE,
|
||||
};
|
||||
|
||||
static void addExtraMemoryProperties(MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
|
||||
|
||||
static MemoryProperties createMemoryProperties(cl_mem_flags flags, cl_mem_flags_intel flagsIntel,
|
||||
cl_mem_alloc_flags_intel allocflags, const Device *pDevice);
|
||||
|
||||
static bool parseMemoryProperties(const cl_mem_properties_intel *properties, MemoryProperties &memoryProperties,
|
||||
cl_mem_flags &flags, cl_mem_flags_intel &flagsIntel, cl_mem_alloc_flags_intel &allocflags,
|
||||
ObjType objectType, Context &context);
|
||||
|
||||
static AllocationProperties getAllocationProperties(
|
||||
uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
|
||||
GraphicsAllocation::AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
||||
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
|
||||
|
||||
static DeviceBitfield adjustDeviceBitfield(uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties,
|
||||
DeviceBitfield subDevicesBitfieldParam);
|
||||
|
||||
static void fillPoliciesInProperties(AllocationProperties &allocationProperties, const MemoryProperties &memoryProperties, const HardwareInfo &hwInfo, bool deviceOnlyVisibilty);
|
||||
|
||||
static void fillCachePolicyInProperties(AllocationProperties &allocationProperties, bool uncached, bool readOnly,
|
||||
bool deviceOnlyVisibilty, uint32_t cacheRegion);
|
||||
|
||||
static uint32_t getCacheRegion(const MemoryProperties &memoryProperties);
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/validators.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
#include "opencl/source/os_interface/ocl_reg_path.h"
|
||||
@@ -108,15 +108,15 @@ cl_mem Buffer::validateInputAndCreateBuffer(cl_context context,
|
||||
MemoryProperties memoryProperties{};
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
cl_mem_flags_intel emptyFlagsIntel = 0;
|
||||
if ((false == MemoryPropertiesHelper::parseMemoryProperties(nullptr, memoryProperties, flags, emptyFlagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::BUFFER, *pContext)) ||
|
||||
if ((false == ClMemoryPropertiesHelper::parseMemoryProperties(nullptr, memoryProperties, flags, emptyFlagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::BUFFER, *pContext)) ||
|
||||
(false == MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, emptyFlagsIntel, *pContext))) {
|
||||
retVal = CL_INVALID_VALUE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ((false == MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::BUFFER, *pContext)) ||
|
||||
if ((false == ClMemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::BUFFER, *pContext)) ||
|
||||
(false == MemObjHelper::validateMemoryPropertiesForBuffer(memoryProperties, flags, flagsIntel, *pContext))) {
|
||||
retVal = CL_INVALID_PROPERTY;
|
||||
return nullptr;
|
||||
@@ -154,7 +154,7 @@ Buffer *Buffer::create(Context *context,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
cl_int &errcodeRet) {
|
||||
return create(context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
return create(context, ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
flags, 0, size, hostPtr, errcodeRet);
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, Sharing
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
auto size = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex)->getUnderlyingBufferSize();
|
||||
auto sharedBuffer = createBufferHw(
|
||||
context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
flags, 0, size, nullptr, nullptr, std::move(multiGraphicsAllocation),
|
||||
false, false, false);
|
||||
|
||||
@@ -514,7 +514,7 @@ Buffer *Buffer::createSubBuffer(cl_mem_flags flags,
|
||||
cl_int &errcodeRet) {
|
||||
DEBUG_BREAK_IF(nullptr == createFunction);
|
||||
MemoryProperties memoryProperties =
|
||||
MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, &this->context->getDevice(0)->getDevice());
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, &this->context->getDevice(0)->getDevice());
|
||||
auto buffer = createFunction(this->context, memoryProperties, flags, 0, region->size,
|
||||
ptrOffset(this->memoryStorage, region->origin),
|
||||
this->hostPtr ? ptrOffset(this->hostPtr, region->origin) : nullptr,
|
||||
@@ -688,7 +688,7 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
|
||||
auto funcCreate = bufferFactory[hwInfo.platform.eRenderCoreFamily].createBufferFunction;
|
||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||
|
||||
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, device);
|
||||
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel, 0, device);
|
||||
auto pBuffer = funcCreate(nullptr, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, std::move(multiGraphicsAllocation),
|
||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#include "opencl/source/cl_device/cl_device_get_cap.inl"
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/get_info_status_mapper.h"
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/mipmap.h"
|
||||
#include "opencl/source/helpers/surface_formats.h"
|
||||
#include "opencl/source/mem_obj/buffer.h"
|
||||
@@ -498,7 +498,7 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
auto size = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex)->getUnderlyingBufferSize();
|
||||
auto sharedImage = createImageHw(
|
||||
context, MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
context, ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
flags, flagsIntel, size, nullptr,
|
||||
surfaceFormat->OCLImageFormat, Image::convertDescriptor(imgInfo.imgDesc), false,
|
||||
std::move(multiGraphicsAllocation), false, baseMipLevel, mipCount, surfaceFormat);
|
||||
@@ -971,8 +971,8 @@ Image *Image::redescribeFillImage() {
|
||||
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
|
||||
|
||||
DEBUG_BREAK_IF(nullptr == createFunction);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0,
|
||||
&context->getDevice(0)->getDevice());
|
||||
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0,
|
||||
&context->getDevice(0)->getDevice());
|
||||
auto image = createFunction(context,
|
||||
memoryProperties,
|
||||
flags | CL_MEM_USE_HOST_PTR,
|
||||
@@ -1028,8 +1028,8 @@ Image *Image::redescribe() {
|
||||
imageFormatNew.image_channel_data_type = surfaceFormat->OCLImageFormat.image_channel_data_type;
|
||||
|
||||
DEBUG_BREAK_IF(nullptr == createFunction);
|
||||
MemoryProperties memoryProperties = MemoryPropertiesHelper::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0,
|
||||
&context->getDevice(0)->getDevice());
|
||||
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags | CL_MEM_USE_HOST_PTR, flagsIntel, 0,
|
||||
&context->getDevice(0)->getDevice());
|
||||
auto image = createFunction(context,
|
||||
memoryProperties,
|
||||
flags | CL_MEM_USE_HOST_PTR,
|
||||
@@ -1092,7 +1092,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch, uint3
|
||||
// Create NV12 UV Plane image
|
||||
std::unique_ptr<Image> imageYPlane(Image::create(
|
||||
context,
|
||||
MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -1116,7 +1116,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch, uint3
|
||||
// Create NV12 UV Plane image
|
||||
std::unique_ptr<Image> imageUVPlane(Image::create(
|
||||
context,
|
||||
MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
flags,
|
||||
0,
|
||||
surfaceFormat,
|
||||
@@ -1185,16 +1185,16 @@ cl_mem Image::validateAndCreateImage(cl_context context,
|
||||
MemoryProperties memoryProperties{};
|
||||
cl_mem_flags_intel emptyFlagsIntel = 0;
|
||||
cl_mem_alloc_flags_intel allocflags = 0;
|
||||
if ((false == MemoryPropertiesHelper::parseMemoryProperties(nullptr, memoryProperties, flags, emptyFlagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::IMAGE, *pContext)) ||
|
||||
if ((false == ClMemoryPropertiesHelper::parseMemoryProperties(nullptr, memoryProperties, flags, emptyFlagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::IMAGE, *pContext)) ||
|
||||
(false == MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, emptyFlagsIntel, imageDesc->mem_object,
|
||||
*pContext))) {
|
||||
errcodeRet = CL_INVALID_VALUE;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ((false == MemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::IMAGE, *pContext)) ||
|
||||
if ((false == ClMemoryPropertiesHelper::parseMemoryProperties(properties, memoryProperties, flags, flagsIntel, allocflags,
|
||||
MemoryPropertiesHelper::ObjType::IMAGE, *pContext)) ||
|
||||
(false == MemObjHelper::validateMemoryPropertiesForImage(memoryProperties, flags, flagsIntel, imageDesc->mem_object,
|
||||
*pContext))) {
|
||||
errcodeRet = CL_INVALID_PROPERTY;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_ext_private.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/mem_obj.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/memory_properties_helpers.h"
|
||||
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/get_info_status_mapper.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -27,7 +27,7 @@ Pipe::Pipe(Context *context,
|
||||
MultiGraphicsAllocation multiGraphicsAllocation)
|
||||
: MemObj(context,
|
||||
CL_MEM_OBJECT_PIPE,
|
||||
MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice()),
|
||||
flags,
|
||||
0,
|
||||
static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace),
|
||||
@@ -55,7 +55,7 @@ Pipe *Pipe::create(Context *context,
|
||||
DEBUG_BREAK_IF(!memoryManager);
|
||||
|
||||
MemoryProperties memoryProperties =
|
||||
MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice());
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice());
|
||||
while (true) {
|
||||
auto size = static_cast<size_t>(packetSize * (maxPackets + 1) + intelPipeHeaderReservedSpace);
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/context/context.h"
|
||||
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
#include "opencl/source/helpers/memory_properties_helpers.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/source/mem_obj/mem_obj_helper.h"
|
||||
|
||||
@@ -100,7 +100,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||
imgInfo.imgDesc.imageHeight /= 2;
|
||||
}
|
||||
MemoryProperties memoryProperties =
|
||||
MemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice());
|
||||
ClMemoryPropertiesHelper::createMemoryProperties(flags, 0, 0, &context->getDevice(0)->getDevice());
|
||||
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo,
|
||||
true, // allocateMemory
|
||||
memoryProperties, context->getDevice(0)->getHardwareInfo(),
|
||||
|
||||
Reference in New Issue
Block a user