2018-09-05 16:10:26 +08:00
|
|
|
/*
|
2020-02-08 00:00:20 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-09-05 16:10:26 +08:00
|
|
|
*
|
2018-09-17 20:03:37 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-09-05 16:10:26 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/bit_helpers.h"
|
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
|
|
|
#include "shared/source/memory_manager/unified_memory_manager.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-26 21:21:01 +08:00
|
|
|
#include "opencl/extensions/public/cl_ext_private.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/helpers/mem_properties_parser_helper.h"
|
|
|
|
#include "opencl/source/mem_obj/mem_obj.h"
|
2018-09-05 16:10:26 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "CL/cl.h"
|
2019-08-09 18:20:05 +08:00
|
|
|
#include "memory_properties_flags.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-09-05 16:10:26 +08:00
|
|
|
|
|
|
|
class MemObjHelper {
|
|
|
|
public:
|
2019-08-29 14:59:15 +08:00
|
|
|
static const uint64_t extraFlags;
|
|
|
|
static const uint64_t extraFlagsIntel;
|
|
|
|
static const uint64_t commonFlags;
|
|
|
|
static const uint64_t commonFlagsIntel;
|
|
|
|
static const uint64_t validFlagsForBuffer;
|
|
|
|
static const uint64_t validFlagsForBufferIntel;
|
|
|
|
static const uint64_t validFlagsForImage;
|
|
|
|
static const uint64_t validFlagsForImageIntel;
|
|
|
|
|
2020-03-30 17:42:07 +08:00
|
|
|
static bool validateMemoryPropertiesForBuffer(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
|
|
|
cl_mem_flags_intel flagsIntel, const Context &context);
|
|
|
|
static bool validateMemoryPropertiesForImage(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
|
|
|
cl_mem_flags_intel flagsIntel, cl_mem parent, const Context &context);
|
|
|
|
static AllocationProperties getAllocationPropertiesWithImageInfo(uint32_t rootDeviceIndex, ImageInfo &imgInfo, bool allocateMemory,
|
|
|
|
const MemoryPropertiesFlags &memoryProperties,
|
2020-04-14 23:07:38 +08:00
|
|
|
const HardwareInfo &hwInfo, DeviceBitfield subDevicesBitfieldParam);
|
2019-08-29 14:59:15 +08:00
|
|
|
static bool checkMemFlagsForSubBuffer(cl_mem_flags flags);
|
|
|
|
static SVMAllocsManager::SvmAllocationProperties getSvmAllocationProperties(cl_mem_flags flags);
|
2020-03-30 17:42:07 +08:00
|
|
|
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryPropertiesFlags &properties, Context &context,
|
|
|
|
bool preferCompression);
|
2019-01-28 22:27:15 +08:00
|
|
|
|
2019-01-09 19:56:38 +08:00
|
|
|
protected:
|
2020-03-30 17:42:07 +08:00
|
|
|
static bool validateExtraMemoryProperties(const MemoryPropertiesFlags &memoryProperties, cl_mem_flags flags,
|
|
|
|
cl_mem_flags_intel flagsIntel, const Context &context);
|
2018-09-05 16:10:26 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|