Reduce unnecessary copies of memory properties
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
parent
a20c0b790a
commit
83cab52dc4
|
@ -43,7 +43,7 @@ ValidateInputAndCreateBufferFunc validateInputAndCreateBuffer = Buffer::validate
|
||||||
} // namespace BufferFunctions
|
} // namespace BufferFunctions
|
||||||
|
|
||||||
Buffer::Buffer(Context *context,
|
Buffer::Buffer(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -175,7 +175,7 @@ Buffer *Buffer::create(Context *context,
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer *Buffer::create(Context *context,
|
Buffer *Buffer::create(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -456,7 +456,7 @@ Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, Sharing
|
||||||
return sharedBuffer;
|
return sharedBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::checkMemory(MemoryProperties memoryProperties,
|
void Buffer::checkMemory(const MemoryProperties &memoryProperties,
|
||||||
size_t size,
|
size_t size,
|
||||||
void *hostPtr,
|
void *hostPtr,
|
||||||
cl_int &errcodeRet,
|
cl_int &errcodeRet,
|
||||||
|
@ -506,7 +506,6 @@ void Buffer::checkMemory(MemoryProperties memoryProperties,
|
||||||
errcodeRet = CL_INVALID_HOST_PTR;
|
errcodeRet = CL_INVALID_HOST_PTR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
|
AllocationType Buffer::getGraphicsAllocationTypeAndCompressionPreference(const MemoryProperties &properties, Context &context,
|
||||||
|
@ -669,7 +668,7 @@ bool Buffer::isReadWriteOnCpuPreferred(void *ptr, size_t size, const Device &dev
|
||||||
}
|
}
|
||||||
|
|
||||||
Buffer *Buffer::createBufferHw(Context *context,
|
Buffer *Buffer::createBufferHw(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
|
|
@ -27,7 +27,7 @@ class MemoryManager;
|
||||||
struct EncodeSurfaceStateArgs;
|
struct EncodeSurfaceStateArgs;
|
||||||
|
|
||||||
using BufferCreatFunc = Buffer *(*)(Context *context,
|
using BufferCreatFunc = Buffer *(*)(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -79,7 +79,7 @@ class Buffer : public MemObj {
|
||||||
cl_int &errcodeRet);
|
cl_int &errcodeRet);
|
||||||
|
|
||||||
static Buffer *create(Context *context,
|
static Buffer *create(Context *context,
|
||||||
MemoryProperties properties,
|
const MemoryProperties &properties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -92,7 +92,7 @@ class Buffer : public MemObj {
|
||||||
MultiGraphicsAllocation multiGraphicsAllocation);
|
MultiGraphicsAllocation multiGraphicsAllocation);
|
||||||
|
|
||||||
static Buffer *createBufferHw(Context *context,
|
static Buffer *createBufferHw(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -163,11 +163,11 @@ class Buffer : public MemObj {
|
||||||
|
|
||||||
bool isCompressed(uint32_t rootDeviceIndex) const;
|
bool isCompressed(uint32_t rootDeviceIndex) const;
|
||||||
|
|
||||||
static bool validateHandleType(MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem);
|
static bool validateHandleType(const MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Buffer(Context *context,
|
Buffer(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -180,7 +180,7 @@ class Buffer : public MemObj {
|
||||||
|
|
||||||
Buffer();
|
Buffer();
|
||||||
|
|
||||||
static void checkMemory(MemoryProperties memoryProperties,
|
static void checkMemory(const MemoryProperties &memoryProperties,
|
||||||
size_t size,
|
size_t size,
|
||||||
void *hostPtr,
|
void *hostPtr,
|
||||||
cl_int &errcodeRet,
|
cl_int &errcodeRet,
|
||||||
|
@ -202,7 +202,7 @@ template <typename GfxFamily>
|
||||||
class BufferHw : public Buffer {
|
class BufferHw : public Buffer {
|
||||||
public:
|
public:
|
||||||
BufferHw(Context *context,
|
BufferHw(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
@ -219,7 +219,7 @@ class BufferHw : public Buffer {
|
||||||
bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
|
bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
|
||||||
|
|
||||||
static Buffer *create(Context *context,
|
static Buffer *create(Context *context,
|
||||||
MemoryProperties memoryProperties,
|
const MemoryProperties &memoryProperties,
|
||||||
cl_mem_flags flags,
|
cl_mem_flags flags,
|
||||||
cl_mem_flags_intel flagsIntel,
|
cl_mem_flags_intel flagsIntel,
|
||||||
size_t size,
|
size_t size,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "opencl/source/mem_obj/buffer.h"
|
#include "opencl/source/mem_obj/buffer.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
bool Buffer::validateHandleType(MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem) {
|
bool Buffer::validateHandleType(const MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem) {
|
||||||
if (memoryProperties.handleType == static_cast<uint64_t>(UnifiedSharingHandleType::LinuxFd)) {
|
if (memoryProperties.handleType == static_cast<uint64_t>(UnifiedSharingHandleType::LinuxFd)) {
|
||||||
extMem.type = UnifiedSharingHandleType::LinuxFd;
|
extMem.type = UnifiedSharingHandleType::LinuxFd;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "opencl/source/mem_obj/buffer.h"
|
#include "opencl/source/mem_obj/buffer.h"
|
||||||
|
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
bool Buffer::validateHandleType(MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem) {
|
bool Buffer::validateHandleType(const MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem) {
|
||||||
if (memoryProperties.handleType == static_cast<uint64_t>(UnifiedSharingHandleType::Win32Nt)) {
|
if (memoryProperties.handleType == static_cast<uint64_t>(UnifiedSharingHandleType::Win32Nt)) {
|
||||||
extMem.type = UnifiedSharingHandleType::Win32Nt;
|
extMem.type = UnifiedSharingHandleType::Win32Nt;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -902,7 +902,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenHwBufferCreationFailsThenReturnNullptr) {
|
||||||
bufferFuncsBackup[i] = bufferFactory[i];
|
bufferFuncsBackup[i] = bufferFactory[i];
|
||||||
bufferFactory[i].createBufferFunction =
|
bufferFactory[i].createBufferFunction =
|
||||||
[](Context *,
|
[](Context *,
|
||||||
MemoryProperties,
|
const MemoryProperties &,
|
||||||
cl_mem_flags,
|
cl_mem_flags,
|
||||||
cl_mem_flags_intel,
|
cl_mem_flags_intel,
|
||||||
size_t,
|
size_t,
|
||||||
|
|
|
@ -22,7 +22,7 @@ class MemoryPropertiesHelper {
|
||||||
};
|
};
|
||||||
|
|
||||||
static AllocationProperties getAllocationProperties(
|
static AllocationProperties getAllocationProperties(
|
||||||
uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
|
uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties, bool allocateMemory, size_t size,
|
||||||
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
||||||
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
|
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
AllocationProperties MemoryPropertiesHelper::getAllocationProperties(
|
AllocationProperties MemoryPropertiesHelper::getAllocationProperties(
|
||||||
uint32_t rootDeviceIndex, MemoryProperties memoryProperties, bool allocateMemory, size_t size,
|
uint32_t rootDeviceIndex, const MemoryProperties &memoryProperties, bool allocateMemory, size_t size,
|
||||||
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
AllocationType type, bool multiStorageResource, const HardwareInfo &hwInfo,
|
||||||
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty) {
|
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue