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
|
||||
|
||||
Buffer::Buffer(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -175,7 +175,7 @@ Buffer *Buffer::create(Context *context,
|
|||
}
|
||||
|
||||
Buffer *Buffer::create(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -456,7 +456,7 @@ Buffer *Buffer::createSharedBuffer(Context *context, cl_mem_flags flags, Sharing
|
|||
return sharedBuffer;
|
||||
}
|
||||
|
||||
void Buffer::checkMemory(MemoryProperties memoryProperties,
|
||||
void Buffer::checkMemory(const MemoryProperties &memoryProperties,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
cl_int &errcodeRet,
|
||||
|
@ -506,7 +506,6 @@ void Buffer::checkMemory(MemoryProperties memoryProperties,
|
|||
errcodeRet = CL_INVALID_HOST_PTR;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
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,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
|
|
@ -27,7 +27,7 @@ class MemoryManager;
|
|||
struct EncodeSurfaceStateArgs;
|
||||
|
||||
using BufferCreatFunc = Buffer *(*)(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -79,7 +79,7 @@ class Buffer : public MemObj {
|
|||
cl_int &errcodeRet);
|
||||
|
||||
static Buffer *create(Context *context,
|
||||
MemoryProperties properties,
|
||||
const MemoryProperties &properties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -92,7 +92,7 @@ class Buffer : public MemObj {
|
|||
MultiGraphicsAllocation multiGraphicsAllocation);
|
||||
|
||||
static Buffer *createBufferHw(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -163,11 +163,11 @@ class Buffer : public MemObj {
|
|||
|
||||
bool isCompressed(uint32_t rootDeviceIndex) const;
|
||||
|
||||
static bool validateHandleType(MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem);
|
||||
static bool validateHandleType(const MemoryProperties &memoryProperties, UnifiedSharingMemoryDescription &extMem);
|
||||
|
||||
protected:
|
||||
Buffer(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -180,7 +180,7 @@ class Buffer : public MemObj {
|
|||
|
||||
Buffer();
|
||||
|
||||
static void checkMemory(MemoryProperties memoryProperties,
|
||||
static void checkMemory(const MemoryProperties &memoryProperties,
|
||||
size_t size,
|
||||
void *hostPtr,
|
||||
cl_int &errcodeRet,
|
||||
|
@ -202,7 +202,7 @@ template <typename GfxFamily>
|
|||
class BufferHw : public Buffer {
|
||||
public:
|
||||
BufferHw(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
@ -219,7 +219,7 @@ class BufferHw : public Buffer {
|
|||
bool isReadOnlyArgument, const Device &device, bool useGlobalAtomics, bool areMultipleSubDevicesInContext) override;
|
||||
|
||||
static Buffer *create(Context *context,
|
||||
MemoryProperties memoryProperties,
|
||||
const MemoryProperties &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
size_t size,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "opencl/source/mem_obj/buffer.h"
|
||||
|
||||
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)) {
|
||||
extMem.type = UnifiedSharingHandleType::LinuxFd;
|
||||
return true;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "opencl/source/mem_obj/buffer.h"
|
||||
|
||||
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)) {
|
||||
extMem.type = UnifiedSharingHandleType::Win32Nt;
|
||||
return true;
|
||||
|
|
|
@ -902,7 +902,7 @@ TEST_P(NoHostPtr, GivenNoHostPtrWhenHwBufferCreationFailsThenReturnNullptr) {
|
|||
bufferFuncsBackup[i] = bufferFactory[i];
|
||||
bufferFactory[i].createBufferFunction =
|
||||
[](Context *,
|
||||
MemoryProperties,
|
||||
const MemoryProperties &,
|
||||
cl_mem_flags,
|
||||
cl_mem_flags_intel,
|
||||
size_t,
|
||||
|
|
|
@ -22,7 +22,7 @@ class MemoryPropertiesHelper {
|
|||
};
|
||||
|
||||
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,
|
||||
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace NEO {
|
||||
|
||||
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,
|
||||
DeviceBitfield subDevicesBitfieldParam, bool deviceOnlyVisibilty) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue