Disable CPU operations for renderCompressed GMM resources

Change-Id: I4396460cab1e030717ea85590775eea0ea92f9db
This commit is contained in:
Dunajski, Bartosz
2018-07-09 15:03:42 +02:00
committed by sys_ocldev
parent 821f31b398
commit e527a439cd
5 changed files with 59 additions and 8 deletions

View File

@@ -30,6 +30,7 @@
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/validators.h"
#include "runtime/helpers/string.h"
#include "runtime/gmm_helper/gmm.h"
#include "runtime/memory_manager/svm_memory_manager.h"
#include "runtime/os_interface/debug_settings_manager.h"
@@ -346,7 +347,8 @@ size_t Buffer::calculateHostPtrSize(const size_t *origin, const size_t *region,
bool Buffer::isReadWriteOnCpuAllowed(cl_bool blocking, cl_uint numEventsInWaitList, void *ptr, size_t size) {
return (blocking == CL_TRUE && numEventsInWaitList == 0 && !forceDisallowCPUCopy) && graphicsAllocation->peekSharedHandle() == 0 &&
(isMemObjZeroCopy() || (reinterpret_cast<uintptr_t>(ptr) & (MemoryConstants::cacheLineSize - 1)) != 0) &&
(!context->getDevice(0)->getDeviceInfo().platformLP || (size <= maxBufferSizeForReadWriteOnCpu));
(!context->getDevice(0)->getDeviceInfo().platformLP || (size <= maxBufferSizeForReadWriteOnCpu)) &&
!(graphicsAllocation->gmm && graphicsAllocation->gmm->isRenderCompressed);
}
Buffer *Buffer::createBufferHw(Context *context,

View File

@@ -26,6 +26,7 @@
#include "runtime/mem_obj/mem_obj.h"
#include "runtime/memory_manager/deferred_deleter.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/gmm_helper/gmm.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/get_info.h"
#include "runtime/command_stream/command_stream_receiver.h"
@@ -346,4 +347,9 @@ bool MemObj::addMappedPtr(void *ptr, size_t ptrLength, cl_map_flags &mapFlags,
return mapOperationsHandler.add(ptr, ptrLength, mapFlags, size, offset,
mipLevel);
}
bool MemObj::mappingOnCpuAllowed() const {
return !allowTiling() && !peekSharingHandler() && !isMipMapped(this) && !DebugManager.flags.DisableZeroCopyForBuffers.get() &&
!(graphicsAllocation->gmm && graphicsAllocation->gmm->isRenderCompressed);
}
} // namespace OCLRT

View File

@@ -120,7 +120,7 @@ class MemObj : public BaseObject<_cl_mem> {
void waitForCsrCompletion();
void destroyGraphicsAllocation(GraphicsAllocation *allocation, bool asyncDestroy);
bool checkIfMemoryTransferIsRequired(size_t offsetInMemObjest, size_t offsetInHostPtr, const void *ptr, cl_command_type cmdType);
bool mappingOnCpuAllowed() const { return !allowTiling() && !peekSharingHandler() && !isMipMapped(this) && !DebugManager.flags.DisableZeroCopyForBuffers.get(); }
bool mappingOnCpuAllowed() const;
virtual size_t calculateOffsetForMapping(const MemObjOffsetArray &offset) const { return offset[0]; }
size_t calculateMappedPtrLength(const MemObjSizeArray &size) const { return calculateOffsetForMapping(size); }
cl_mem_object_type peekClMemObjType() const { return memObjectType; }