mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
refactor: Add key to force zero copy without coherency
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
253035878a
commit
c8c3f862f4
@@ -436,7 +436,7 @@ bool MemObj::mappingOnCpuAllowed() const {
|
||||
auto graphicsAllocation = multiGraphicsAllocation.getDefaultGraphicsAllocation();
|
||||
return !isTiledAllocation() && !peekSharingHandler() && !isMipMapped(this) && !debugManager.flags.DisableZeroCopyForBuffers.get() &&
|
||||
!graphicsAllocation->isCompressionEnabled() && MemoryPoolHelper::isSystemMemoryPool(graphicsAllocation->getMemoryPool()) &&
|
||||
allowCpuAccess();
|
||||
allowCpuForMapUnmap();
|
||||
}
|
||||
|
||||
bool MemObj::allowCpuAccess() const {
|
||||
@@ -448,6 +448,14 @@ bool MemObj::allowCpuAccess() const {
|
||||
return !graphicsAllocation->getDefaultGmm()->getPreferNoCpuAccess();
|
||||
}
|
||||
|
||||
bool MemObj::allowCpuForMapUnmap() const {
|
||||
auto ret = allowCpuAccess();
|
||||
if (debugManager.flags.AllowZeroCopyWithoutCoherency.get() != -1) {
|
||||
ret = debugManager.flags.AllowZeroCopyWithoutCoherency.get();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void MemObj::storeProperties(const cl_mem_properties *properties) {
|
||||
if (properties) {
|
||||
for (size_t i = 0; properties[i] != 0; i += 2) {
|
||||
|
||||
@@ -132,6 +132,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
bool checkIfMemoryTransferIsRequired(size_t offsetInMemObject, size_t offsetInHostPtr, const void *ptr, cl_command_type cmdType);
|
||||
bool mappingOnCpuAllowed() const;
|
||||
MOCKABLE_VIRTUAL bool allowCpuAccess() const;
|
||||
bool allowCpuForMapUnmap() 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; }
|
||||
|
||||
Reference in New Issue
Block a user