Move AllocationType enum out of GraphicsAllocation class

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-02-04 13:59:01 +00:00
committed by Compute-Runtime-Automation
parent fd27098194
commit 4b0d986876
262 changed files with 2075 additions and 2063 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -35,12 +35,12 @@ cl_int CommandQueueHw<GfxFamily>::enqueueFillBuffer(
auto commandStreamReceieverOwnership = getGpgpuCommandStreamReceiver().obtainUniqueOwnership();
auto storageWithAllocations = getGpgpuCommandStreamReceiver().getInternalAllocationStorage();
auto allocationType = GraphicsAllocation::AllocationType::FILL_PATTERN;
auto allocationType = AllocationType::FILL_PATTERN;
auto patternAllocation = storageWithAllocations->obtainReusableAllocation(patternSize, allocationType).release();
commandStreamReceieverOwnership.unlock();
if (!patternAllocation) {
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({getDevice().getRootDeviceIndex(), alignUp(patternSize, MemoryConstants::cacheLineSize), GraphicsAllocation::AllocationType::FILL_PATTERN, getDevice().getDeviceBitfield()});
patternAllocation = memoryManager->allocateGraphicsMemoryWithProperties({getDevice().getRootDeviceIndex(), alignUp(patternSize, MemoryConstants::cacheLineSize), AllocationType::FILL_PATTERN, getDevice().getDeviceBitfield()});
}
if (patternSize == 1) {

View File

@@ -77,7 +77,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMap(cl_bool blockingMap,
}
bool blocking = blockingMap == CL_TRUE;
if (svmData->gpuAllocations.getAllocationType() == GraphicsAllocation::AllocationType::SVM_ZERO_COPY) {
if (svmData->gpuAllocations.getAllocationType() == AllocationType::SVM_ZERO_COPY) {
NullSurface s;
Surface *surfaces[] = {&s};
if (context->isProvidingPerformanceHints()) {
@@ -153,7 +153,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMUnmap(void *svmPtr,
return CL_INVALID_VALUE;
}
if (svmData->gpuAllocations.getAllocationType() == GraphicsAllocation::AllocationType::SVM_ZERO_COPY) {
if (svmData->gpuAllocations.getAllocationType() == AllocationType::SVM_ZERO_COPY) {
NullSurface s;
Surface *surfaces[] = {&s};
enqueueHandler<CL_COMMAND_SVM_UNMAP>(surfaces,
@@ -457,7 +457,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueSVMMemFill(void *svmPtr,
auto commandStreamReceieverOwnership = getGpgpuCommandStreamReceiver().obtainUniqueOwnership();
auto storageWithAllocations = getGpgpuCommandStreamReceiver().getInternalAllocationStorage();
auto allocationType = GraphicsAllocation::AllocationType::FILL_PATTERN;
auto allocationType = AllocationType::FILL_PATTERN;
auto patternAllocation = storageWithAllocations->obtainReusableAllocation(patternSize, allocationType).release();
commandStreamReceieverOwnership.unlock();

View File

@@ -326,7 +326,7 @@ cl_int Kernel::patchPrivateSurface() {
privateSurface = executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties(
{rootDeviceIndex,
static_cast<size_t>(privateSurfaceSize),
GraphicsAllocation::AllocationType::PRIVATE_SURFACE,
AllocationType::PRIVATE_SURFACE,
pClDevice->getDeviceBitfield()});
if (privateSurface == nullptr) {
return CL_OUT_OF_RESOURCES;
@@ -1928,7 +1928,7 @@ bool Kernel::hasDirectStatelessAccessToSharedBuffer() const {
const auto &arg = kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[i];
if (BUFFER_OBJ == kernelArguments.at(i).type && !arg.as<ArgDescPointer>().isPureStateful()) {
auto buffer = castToObject<Buffer>(getKernelArg(i));
if (buffer && buffer->getMultiGraphicsAllocation().getAllocationType() == GraphicsAllocation::AllocationType::SHARED_BUFFER) {
if (buffer && buffer->getMultiGraphicsAllocation().getAllocationType() == AllocationType::SHARED_BUFFER) {
return true;
}
}
@@ -1941,13 +1941,13 @@ bool Kernel::hasDirectStatelessAccessToHostMemory() const {
const auto &arg = kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[i];
if (BUFFER_OBJ == kernelArguments.at(i).type && !arg.as<ArgDescPointer>().isPureStateful()) {
auto buffer = castToObject<Buffer>(getKernelArg(i));
if (buffer && buffer->getMultiGraphicsAllocation().getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY) {
if (buffer && buffer->getMultiGraphicsAllocation().getAllocationType() == AllocationType::BUFFER_HOST_MEMORY) {
return true;
}
}
if (SVM_ALLOC_OBJ == kernelArguments.at(i).type && !arg.as<ArgDescPointer>().isPureStateful()) {
auto svmAlloc = reinterpret_cast<const GraphicsAllocation *>(getKernelArg(i));
if (svmAlloc && svmAlloc->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY) {
if (svmAlloc && svmAlloc->getAllocationType() == AllocationType::BUFFER_HOST_MEMORY) {
return true;
}
}
@@ -1961,7 +1961,7 @@ bool Kernel::hasIndirectStatelessAccessToHostMemory() const {
}
for (auto gfxAllocation : kernelUnifiedMemoryGfxAllocations) {
if (gfxAllocation->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY) {
if (gfxAllocation->getAllocationType() == AllocationType::BUFFER_HOST_MEMORY) {
return true;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -214,7 +214,7 @@ Buffer *Buffer::create(Context *context,
allocationInfo[rootDeviceIndex].allocateMemory = true;
}
if (allocationInfo[rootDeviceIndex].allocationType == GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY) {
if (allocationInfo[rootDeviceIndex].allocationType == AllocationType::BUFFER_HOST_MEMORY) {
if (memoryProperties.flags.useHostPtr) {
if (allocationInfo[rootDeviceIndex].alignementSatisfied) {
allocationInfo[rootDeviceIndex].allocateMemory = false;
@@ -239,7 +239,7 @@ Buffer *Buffer::create(Context *context,
allocationInfo[rootDeviceIndex].memory = svmData->gpuAllocations.getGraphicsAllocation(rootDeviceIndex);
allocationInfo[rootDeviceIndex].allocationType = allocationInfo[rootDeviceIndex].memory->getAllocationType();
allocationInfo[rootDeviceIndex].isHostPtrSVM = true;
allocationInfo[rootDeviceIndex].zeroCopyAllowed = allocationInfo[rootDeviceIndex].memory->getAllocationType() == GraphicsAllocation::AllocationType::SVM_ZERO_COPY;
allocationInfo[rootDeviceIndex].zeroCopyAllowed = allocationInfo[rootDeviceIndex].memory->getAllocationType() == AllocationType::SVM_ZERO_COPY;
allocationInfo[rootDeviceIndex].copyMemoryFromHostPtr = false;
allocationInfo[rootDeviceIndex].allocateMemory = false;
allocationInfo[rootDeviceIndex].mapAllocation = svmData->cpuAllocation;
@@ -297,7 +297,7 @@ Buffer *Buffer::create(Context *context,
//if allocation failed for CL_MEM_USE_HOST_PTR case retry with non zero copy path
if (memoryProperties.flags.useHostPtr && !allocationInfo[rootDeviceIndex].memory && Buffer::isReadOnlyMemoryPermittedByFlags(memoryProperties)) {
allocationInfo[rootDeviceIndex].allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
allocationInfo[rootDeviceIndex].allocationType = AllocationType::BUFFER_HOST_MEMORY;
allocationInfo[rootDeviceIndex].zeroCopyAllowed = false;
allocationInfo[rootDeviceIndex].copyMemoryFromHostPtr = true;
AllocationProperties allocProperties = MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
@@ -322,8 +322,8 @@ Buffer *Buffer::create(Context *context,
allocationInfo[rootDeviceIndex].copyMemoryFromHostPtr = true;
}
}
} else if (allocationInfo[rootDeviceIndex].allocationType == GraphicsAllocation::AllocationType::BUFFER && !compressionEnabled) {
allocationInfo[rootDeviceIndex].allocationType = GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
} else if (allocationInfo[rootDeviceIndex].allocationType == AllocationType::BUFFER && !compressionEnabled) {
allocationInfo[rootDeviceIndex].allocationType = AllocationType::BUFFER_HOST_MEMORY;
}
allocationInfo[rootDeviceIndex].memory->setAllocationType(allocationInfo[rootDeviceIndex].allocationType);
@@ -368,7 +368,7 @@ Buffer *Buffer::create(Context *context,
if (!allocationInfo[rootDeviceIndex].zeroCopyAllowed && !allocationInfo[rootDeviceIndex].isHostPtrSVM) {
AllocationProperties properties{rootDeviceIndex,
false, // allocateMemory
size, GraphicsAllocation::AllocationType::MAP_ALLOCATION,
size, AllocationType::MAP_ALLOCATION,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex)};
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
@@ -494,19 +494,19 @@ void Buffer::checkMemory(MemoryProperties memoryProperties,
return;
}
GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
bool &compressionEnabled, bool isLocalMemoryEnabled) {
AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
bool &compressionEnabled, bool isLocalMemoryEnabled) {
if (context.isSharedContext || properties.flags.forceHostMemory) {
compressionEnabled = false;
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
return AllocationType::BUFFER_HOST_MEMORY;
}
if (properties.flags.useHostPtr && !isLocalMemoryEnabled) {
compressionEnabled = false;
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
return AllocationType::BUFFER_HOST_MEMORY;
}
return GraphicsAllocation::AllocationType::BUFFER;
return AllocationType::BUFFER;
}
bool Buffer::isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -186,8 +186,8 @@ class Buffer : public MemObj {
MemoryManager *memMngr,
uint32_t rootDeviceIndex,
bool forceCopyHostPtr);
static GraphicsAllocation::AllocationType getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
bool &compressionEnabled, bool localMemoryEnabled);
static AllocationType getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
bool &compressionEnabled, bool localMemoryEnabled);
static bool isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties);
void transferData(void *dst, void *src, size_t copySize, size_t copyOffset);

View File

@@ -307,7 +307,7 @@ Image *Image::create(Context *context,
gmm = new Gmm(clientContext, imgInfo, StorageInfo{}, preferCompression);
allocationInfo[rootDeviceIndex].memory = memoryManager->allocateGraphicsMemoryWithProperties({rootDeviceIndex,
false, // allocateMemory
imgInfo.size, GraphicsAllocation::AllocationType::SHARED_CONTEXT_IMAGE,
imgInfo.size, AllocationType::SHARED_CONTEXT_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex)},
hostPtr);
@@ -318,7 +318,7 @@ Image *Image::create(Context *context,
if (allocationInfo[rootDeviceIndex].memory) {
AllocationProperties properties{rootDeviceIndex,
false, // allocateMemory
hostPtrMinSize, GraphicsAllocation::AllocationType::MAP_ALLOCATION,
hostPtrMinSize, AllocationType::MAP_ALLOCATION,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex)};
properties.flags.flushL3RequiredForRead = properties.flags.flushL3RequiredForWrite = true;
@@ -348,7 +348,7 @@ Image *Image::create(Context *context,
}
if (parentBuffer == nullptr) {
allocationInfo[rootDeviceIndex].memory->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
allocationInfo[rootDeviceIndex].memory->setAllocationType(AllocationType::IMAGE);
}
allocationInfo[rootDeviceIndex].memory->setMemObjectsAllocationWithWritableFlags(!memoryProperties.flags.readOnly &&

View File

@@ -373,7 +373,7 @@ void *MemObj::getBasePtrForMap(uint32_t rootDeviceIndex) {
}
AllocationProperties properties{rootDeviceIndex,
false, // allocateMemory
getSize(), GraphicsAllocation::AllocationType::MAP_ALLOCATION,
getSize(), AllocationType::MAP_ALLOCATION,
false, //isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex)};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -40,7 +40,7 @@ namespace CreateMemObj {
struct AllocationInfo {
GraphicsAllocation *mapAllocation = nullptr;
GraphicsAllocation *memory = nullptr;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
AllocationType allocationType = AllocationType::UNKNOWN;
bool zeroCopyAllowed = true;
bool isHostPtrSVM = false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -80,7 +80,7 @@ AllocationProperties MemObjHelper::getAllocationPropertiesWithImageInfo(
const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty) {
auto deviceBitfield = MemoryPropertiesHelper::adjustDeviceBitfield(rootDeviceIndex, memoryProperties, subDevicesBitfieldParam);
AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, GraphicsAllocation::AllocationType::IMAGE, deviceBitfield};
AllocationProperties allocationProperties{rootDeviceIndex, allocateMemory, imgInfo, AllocationType::IMAGE, deviceBitfield};
MemoryPropertiesHelper::fillPoliciesInProperties(allocationProperties, memoryProperties, hwInfo, deviceOnlyVisibilty);
return allocationProperties;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -62,7 +62,7 @@ Pipe *Pipe::create(Context *context,
AllocationProperties allocProperties =
MemoryPropertiesHelper::getAllocationProperties(rootDeviceIndex, memoryProperties,
true, // allocateMemory
size, GraphicsAllocation::AllocationType::PIPE,
size, AllocationType::PIPE,
false, // isMultiStorageAllocation
context->getDevice(0)->getHardwareInfo(), context->getDeviceBitfieldForAllocation(rootDeviceIndex),
context->isSingleDeviceContext());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -11,10 +11,10 @@
namespace NEO {
bool CompressionSelector::preferCompressedAllocation(const AllocationProperties &properties, const HardwareInfo &hwInfo) {
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
case GraphicsAllocation::AllocationType::SVM_GPU:
case GraphicsAllocation::AllocationType::PRINTF_SURFACE: {
case AllocationType::GLOBAL_SURFACE:
case AllocationType::CONSTANT_SURFACE:
case AllocationType::SVM_GPU:
case AllocationType::PRINTF_SURFACE: {
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
return hwInfoConfig.allowStatelessCompression(hwInfo);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -55,7 +55,7 @@ void MigrationController::migrateMemory(Context &context, MemoryManager &memoryM
} else {
auto srcCmdQ = context.getSpecialQueue(sourceRootDeviceIndex);
if (srcMemory->getAllocationType() == GraphicsAllocation::AllocationType::IMAGE) {
if (srcMemory->getAllocationType() == AllocationType::IMAGE) {
auto pImage = static_cast<Image *>(memObj);
size_t origin[3] = {};
size_t region[3] = {};
@@ -76,7 +76,7 @@ void MigrationController::migrateMemory(Context &context, MemoryManager &memoryM
} else {
auto dstCmdQ = context.getSpecialQueue(targetRootDeviceIndex);
if (dstMemory->getAllocationType() == GraphicsAllocation::AllocationType::IMAGE) {
if (dstMemory->getAllocationType() == AllocationType::IMAGE) {
auto pImage = static_cast<Image *>(memObj);
size_t origin[3] = {};
size_t region[3] = {};

View File

@@ -52,7 +52,7 @@ void PrintfHandler::prepareDispatch(const MultiDispatchInfo &multiDispatchInfo)
}
auto rootDeviceIndex = device.getRootDeviceIndex();
kernel = multiDispatchInfo.peekMainKernel();
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, printfSurfaceSize, GraphicsAllocation::AllocationType::PRINTF_SURFACE, device.getDeviceBitfield()});
printfSurface = device.getMemoryManager()->allocateGraphicsMemoryWithProperties({rootDeviceIndex, printfSurfaceSize, AllocationType::PRINTF_SURFACE, device.getDeviceBitfield()});
auto &hwInfo = device.getHardwareInfo();
auto &helper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -42,7 +42,7 @@ class D3DBuffer : public D3DSharing<D3D> {
AllocationProperties properties = {context->getDevice(0)->getRootDeviceIndex(),
false, // allocateMemory
0, // size
GraphicsAllocation::AllocationType::SHARED_BUFFER,
AllocationType::SHARED_BUFFER,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
auto alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(toOsHandle(sharedHandle), properties, true, false);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -84,7 +84,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
GraphicsAllocation::AllocationType::SHARED_IMAGE,
AllocationType::SHARED_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(toOsHandle(surfaceInfo->shared_handle), allocProperties,
@@ -106,7 +106,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
memoryProperties, context->getDevice(0)->getHardwareInfo(),
context->getDeviceBitfieldForAllocation(rootDeviceIndex),
context->isSingleDeviceContext());
allocProperties.allocationType = GraphicsAllocation::AllocationType::SHARED_RESOURCE_COPY;
allocProperties.allocationType = AllocationType::SHARED_RESOURCE_COPY;
alloc = context->getMemoryManager()->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -77,7 +77,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, true)) {
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex, GraphicsAllocation::AllocationType::SHARED_IMAGE);
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex, AllocationType::SHARED_IMAGE);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
@@ -87,7 +87,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
GraphicsAllocation::AllocationType::SHARED_IMAGE,
AllocationType::SHARED_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, false)) {
@@ -169,7 +169,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, true)) {
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex, GraphicsAllocation::AllocationType::SHARED_IMAGE);
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex, AllocationType::SHARED_IMAGE);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
@@ -179,7 +179,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
GraphicsAllocation::AllocationType::SHARED_IMAGE,
AllocationType::SHARED_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, false)) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -146,7 +146,7 @@ GraphicsAllocation *GlBuffer::createGraphicsAllocation(Context *context, unsigne
AllocationProperties properties = {context->getDevice(0)->getRootDeviceIndex(),
false, // allocateMemory
0u, // size
GraphicsAllocation::AllocationType::SHARED_BUFFER,
AllocationType::SHARED_BUFFER,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
// couldn't find allocation for reuse - create new

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -54,7 +54,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(),
false, // allocateMemory
0u, // size
GraphicsAllocation::AllocationType::SHARED_IMAGE,
AllocationType::SHARED_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandle, allocProperties, false, false);
@@ -125,7 +125,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
GraphicsAllocation *mcsAlloc = nullptr;
if (texInfo.globalShareHandleMCS) {
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), 0, GraphicsAllocation::AllocationType::MCS, context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
AllocationProperties allocProperties(context->getDevice(0)->getRootDeviceIndex(), 0, AllocationType::MCS, context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
mcsAlloc = memoryManager->createGraphicsAllocationFromSharedHandle(texInfo.globalShareHandleMCS, allocProperties, false, false);
if (texInfo.pGmmResInfoMCS) {
DEBUG_BREAK_IF(mcsAlloc->getDefaultGmm() != nullptr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -21,7 +21,7 @@ using namespace NEO;
Buffer *UnifiedBuffer::createSharedUnifiedBuffer(Context *context, cl_mem_flags flags, UnifiedSharingMemoryDescription extMem, cl_int *errcodeRet) {
ErrorCodeHelper errorCode(errcodeRet, CL_SUCCESS);
auto graphicsAllocation = UnifiedBuffer::createGraphicsAllocation(context, extMem, GraphicsAllocation::AllocationType::SHARED_BUFFER);
auto graphicsAllocation = UnifiedBuffer::createGraphicsAllocation(context, extMem, AllocationType::SHARED_BUFFER);
if (!graphicsAllocation) {
errorCode.set(CL_INVALID_MEM_OBJECT);
return nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -32,7 +32,7 @@ Image *UnifiedImage::createSharedUnifiedImage(Context *context, cl_mem_flags fla
imgInfo.imgDesc = Image::convertDescriptor(*imageDesc);
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
GraphicsAllocation *graphicsAllocation = createGraphicsAllocation(context, description, GraphicsAllocation::AllocationType::SHARED_IMAGE);
GraphicsAllocation *graphicsAllocation = createGraphicsAllocation(context, description, AllocationType::SHARED_IMAGE);
if (!graphicsAllocation) {
errorCode.set(CL_INVALID_MEM_OBJECT);
return nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -32,11 +32,11 @@ void UnifiedSharing::synchronizeObject(UpdateData &updateData) {
void UnifiedSharing::releaseResource(MemObj *memObject, uint32_t rootDeviceIndex) {
}
GraphicsAllocation *UnifiedSharing::createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, GraphicsAllocation::AllocationType allocationType) {
GraphicsAllocation *UnifiedSharing::createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, AllocationType allocationType) {
auto memoryManager = context->getMemoryManager();
switch (description.type) {
case UnifiedSharingHandleType::Win32Nt: {
return memoryManager->createGraphicsAllocationFromNTHandle(description.handle, context->getDevice(0)->getRootDeviceIndex(), GraphicsAllocation::AllocationType::SHARED_IMAGE);
return memoryManager->createGraphicsAllocationFromNTHandle(description.handle, context->getDevice(0)->getRootDeviceIndex(), AllocationType::SHARED_IMAGE);
}
case UnifiedSharingHandleType::LinuxFd:
case UnifiedSharingHandleType::Win32Shared: {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -40,7 +40,7 @@ class UnifiedSharing : public SharingHandler {
void synchronizeObject(UpdateData &updateData) override;
void releaseResource(MemObj *memObject, uint32_t rootDeviceIndex) override;
static GraphicsAllocation *createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, GraphicsAllocation::AllocationType allocationType);
static GraphicsAllocation *createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, AllocationType allocationType);
private:
UnifiedSharingFunctions *sharingFunctions;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -113,7 +113,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
AllocationProperties properties(context->getDevice(0)->getRootDeviceIndex(),
false, // allocateMemory
imgInfo, GraphicsAllocation::AllocationType::SHARED_IMAGE,
imgInfo, AllocationType::SHARED_IMAGE,
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, properties, false, false);