refactor: remove unused isSharedContext variable

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-07-25 14:44:02 +02:00
committed by Compute-Runtime-Automation
parent ea7d9fe106
commit f84f22d23c
29 changed files with 38 additions and 308 deletions

View File

@@ -340,7 +340,7 @@ Buffer *Buffer::create(Context *context,
bool compressionEnabled = MemObjHelper::isSuitableForCompression(GfxCoreHelper::compressedBuffersSupported(*hwInfo), memoryProperties, *context,
gfxCoreHelper.isBufferSizeSuitableForCompression(size));
allocationInfo.allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, *context, compressionEnabled,
allocationInfo.allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled,
memoryManager->isLocalMemorySupported(rootDeviceIndex));
if (allocationCpuPtr) {
@@ -391,12 +391,6 @@ Buffer *Buffer::create(Context *context,
}
}
if (context->isSharedContext) {
allocationInfo.zeroCopyAllowed = true;
allocationInfo.copyMemoryFromHostPtr = false;
allocationInfo.allocateMemory = false;
}
if (!bufferCreateArgs.doNotProvidePerformanceHints && hostPtr && context->isProvidingPerformanceHints()) {
if (allocationInfo.zeroCopyAllowed) {
context->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL, CL_BUFFER_MEETS_ALIGNMENT_RESTRICTIONS, hostPtr, size);
@@ -630,9 +624,9 @@ void Buffer::checkMemory(const MemoryProperties &memoryProperties,
}
}
AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties,
bool &compressionEnabled, bool isLocalMemoryEnabled) {
if (context.isSharedContext || properties.flags.forceHostMemory) {
if (properties.flags.forceHostMemory) {
compressionEnabled = false;
return AllocationType::BUFFER_HOST_MEMORY;
}

View File

@@ -208,7 +208,7 @@ class Buffer : public MemObj {
MemoryManager *memMngr,
uint32_t rootDeviceIndex,
bool forceCopyHostPtr);
static AllocationType getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
static AllocationType getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties,
bool &compressionEnabled, bool localMemoryEnabled);
static bool isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties);

View File

@@ -173,7 +173,7 @@ Image *Image::create(Context *context,
const auto hostPtrSlicePitch = getHostPtrSlicePitch(*imageDesc, hostPtrRowPitch, imageHeight);
auto &defaultProductHelper = defaultDevice->getProductHelper();
imgInfo.linearStorage = defaultProductHelper.isLinearStoragePreferred(context->isSharedContext, Image::isImage1d(*imageDesc),
imgInfo.linearStorage = defaultProductHelper.isLinearStoragePreferred(Image::isImage1d(*imageDesc),
memoryProperties.flags.forceLinearStorage);
// if device doesn't support images, it can create only linear images
@@ -223,10 +223,6 @@ Image *Image::create(Context *context,
// Image from parent image - reuse allocation from parent image
allocationInfo.memory = parentImage->getGraphicsAllocation(rootDeviceIndex);
allocationInfo.memory->getDefaultGmm()->queryImageParams(imgInfo);
} else if (memoryProperties.flags.useHostPtr && context->isSharedContext) {
// create graphics allocation from shared context
setAllocationInfoFromHostPtrWithSharedContext(allocationInfo, rootDeviceIndex, imgInfo, context,
preferCompression, memoryManager, hostPtr);
} else if (memoryProperties.flags.useHostPtr) {
// create graphics allocation from shared context
setAllocationInfoFromHostPtr(allocationInfo, rootDeviceIndex, hwInfo, memoryProperties, imgInfo, context,
@@ -1176,24 +1172,6 @@ void Image::setAllocationInfoFromParentBuffer(CreateMemObj::AllocationInfo &allo
imageInfo.offset = parentBuffer->getOffset();
}
void Image::setAllocationInfoFromHostPtrWithSharedContext(CreateMemObj::AllocationInfo &allocationInfo, uint32_t rootDeviceIndex, ImageInfo &imageInfo,
Context *context, bool preferCompression, MemoryManager *memoryManager, const void *hostPtr) {
auto &rootDeviceEnvironment = *memoryManager->peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex];
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
auto gmm = new Gmm(gmmHelper, imageInfo, StorageInfo{}, preferCompression);
AllocationProperties properties{rootDeviceIndex,
false, // allocateMemory
imageInfo.size, AllocationType::SHARED_CONTEXT_IMAGE,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex)};
allocationInfo.memory = memoryManager->allocateGraphicsMemoryWithProperties(properties, hostPtr);
allocationInfo.memory->setDefaultGmm(gmm);
allocationInfo.zeroCopyAllowed = true;
}
void Image::setAllocationInfoFromHostPtr(CreateMemObj::AllocationInfo &allocationInfo, uint32_t rootDeviceIndex, const HardwareInfo &hwInfo,
const MemoryProperties &memoryProperties, ImageInfo &imageInfo, Context *context, bool preferCompression,
MemoryManager *memoryManager, const void *hostPtr, size_t hostPtrMinSize) {

View File

@@ -272,9 +272,6 @@ class Image : public MemObj {
static void setAllocationInfoFromParentBuffer(CreateMemObj::AllocationInfo &allocationInfo, const void *&hostPtr, void *&hostPtrToSet,
Buffer *parentBuffer, ImageInfo &imageInfo, uint32_t rootDeviceIndex);
static void setAllocationInfoFromHostPtrWithSharedContext(CreateMemObj::AllocationInfo &allocationInfo, uint32_t rootDeviceIndex, ImageInfo &imageInfo,
Context *context, bool preferCompression, MemoryManager *memoryManager, const void *hostPtr);
static void setAllocationInfoFromHostPtr(CreateMemObj::AllocationInfo &allocationInfo, uint32_t rootDeviceIndex, const HardwareInfo &hwInfo,
const MemoryProperties &memoryProperties, ImageInfo &imageInfo, Context *context, bool preferCompression,
MemoryManager *memoryManager, const void *hostPtr, size_t hostPtrMinSize);