Add MultiGraphicsAllocation to MemObj class

use it to get allocation type and coherency status

Related-To: NEO-4672
Change-Id: Id1fdc358f7e2038e78c1225ebc986b2a7775c665
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2020-05-28 11:38:43 +02:00
committed by sys_ocldev
parent aa0388e791
commit 1db6d28754
6 changed files with 14 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ bool Buffer::isSubBuffer() {
}
bool Buffer::isValidSubBufferOffset(size_t offset) {
if (this->getGraphicsAllocation()->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
if (multiGraphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
// From spec: "origin value is aligned to the CL_DEVICE_MEM_BASE_ADDR_ALIGN value"
if (!isAligned(offset, this->getContext()->getDevice(0)->getDeviceInfo().memBaseAddressAlign / 8u)) {
return false;
@@ -650,7 +650,7 @@ bool Buffer::isCompressed() const {
if (this->getGraphicsAllocation()->getDefaultGmm()) {
return this->getGraphicsAllocation()->getDefaultGmm()->isRenderCompressed;
}
if (this->getGraphicsAllocation()->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
if (multiGraphicsAllocation.getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
return true;
}

View File

@@ -42,7 +42,7 @@ MemObj::MemObj(Context *context,
: context(context), memObjectType(memObjectType), memoryProperties(memoryProperties), flags(flags), flagsIntel(flagsIntel), size(size),
memoryStorage(memoryStorage), hostPtr(hostPtr),
isZeroCopy(zeroCopy), isHostPtrSVM(isHostPtrSVM), isObjectRedescribed(isObjectRedescribed),
graphicsAllocation(gfxAllocation) {
graphicsAllocation(gfxAllocation), multiGraphicsAllocation(graphicsAllocation ? graphicsAllocation->getRootDeviceIndex() : 0) {
if (context) {
context->incRefInternal();
@@ -51,6 +51,9 @@ MemObj::MemObj(Context *context,
executionEnvironment = device->getExecutionEnvironment();
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()].get();
}
if (graphicsAllocation) {
multiGraphicsAllocation.addAllocation(graphicsAllocation);
}
}
MemObj::~MemObj() {

View File

@@ -7,6 +7,7 @@
#pragma once
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/memory_manager/multi_graphics_allocation.h"
#include "opencl/extensions/public/cl_ext_private.h"
#include "opencl/source/api/cl_types.h"
@@ -127,6 +128,7 @@ class MemObj : public BaseObject<_cl_mem> {
const cl_mem_flags &getFlags() const { return flags; }
const cl_mem_flags &getFlagsIntel() const { return flagsIntel; }
const MultiGraphicsAllocation &getMultiGraphicsAllocation() const { return multiGraphicsAllocation; }
protected:
void getOsSpecificMemObjectInfo(const cl_mem_info &paramName, size_t *srcParamSize, void **srcParam);
@@ -153,6 +155,7 @@ class MemObj : public BaseObject<_cl_mem> {
bool isObjectRedescribed;
MemoryManager *memoryManager = nullptr;
GraphicsAllocation *graphicsAllocation;
MultiGraphicsAllocation multiGraphicsAllocation;
GraphicsAllocation *mcsAllocation = nullptr;
GraphicsAllocation *mapAllocation = nullptr;
std::shared_ptr<SharingHandler> sharingHandler;