performance: change buffer type for new coherency model

Related-To: NEO-11882

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2024-07-02 07:50:14 +00:00
committed by Compute-Runtime-Automation
parent b4903a9a0f
commit c979495265
10 changed files with 143 additions and 52 deletions

View File

@@ -339,12 +339,14 @@ Buffer *Buffer::create(Context *context,
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex];
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
bool compressionEnabled = MemObjHelper::isSuitableForCompression(GfxCoreHelper::compressedBuffersSupported(*hwInfo), memoryProperties, *context,
gfxCoreHelper.isBufferSizeSuitableForCompression(size));
auto isNewCoherencyModelSupported = productHelper.isNewCoherencyModelSupported();
allocationInfo.allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, compressionEnabled,
memoryManager->isLocalMemorySupported(rootDeviceIndex));
memoryManager->isLocalMemorySupported(rootDeviceIndex),
isNewCoherencyModelSupported);
if (allocationCpuPtr) {
forceCopyHostPtr = !useHostPtr && !copyHostPtr;
@@ -372,6 +374,9 @@ Buffer *Buffer::create(Context *context,
allocationInfo.zeroCopyAllowed = false;
allocationInfo.allocateMemory = true;
}
} else if (isNewCoherencyModelSupported) {
allocationInfo.zeroCopyAllowed = false;
allocationInfo.allocateMemory = true;
}
if (debugManager.flags.DisableZeroCopyForUseHostPtr.get()) {
@@ -638,13 +643,14 @@ void Buffer::checkMemory(const MemoryProperties &memoryProperties,
}
AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties,
bool &compressionEnabled, bool isLocalMemoryEnabled) {
bool &compressionEnabled, bool isLocalMemoryEnabled,
bool isNewCoherencyModelSupported) {
if (properties.flags.forceHostMemory) {
compressionEnabled = false;
return AllocationType::bufferHostMemory;
}
if (properties.flags.useHostPtr && !isLocalMemoryEnabled) {
if (properties.flags.useHostPtr && (!isLocalMemoryEnabled && !isNewCoherencyModelSupported)) {
compressionEnabled = false;
return AllocationType::bufferHostMemory;
}

View File

@@ -208,7 +208,8 @@ class Buffer : public MemObj {
uint32_t rootDeviceIndex,
bool forceCopyHostPtr);
static AllocationType getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties,
bool &compressionEnabled, bool localMemoryEnabled);
bool &compressionEnabled, bool localMemoryEnabled,
bool isNewCoherencyModelSupported);
static bool isReadOnlyMemoryPermittedByFlags(const MemoryProperties &properties);
void transferData(void *dst, void *src, size_t copySize, size_t copyOffset);