2018-09-05 16:10:26 +08:00
|
|
|
/*
|
2019-01-09 19:56:38 +08:00
|
|
|
* Copyright (C) 2018-2019 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
|
2019-01-29 16:54:50 +08:00
|
|
|
#include "common/helpers/bit_helpers.h"
|
2019-09-26 18:10:38 +08:00
|
|
|
#include "core/memory_manager/unified_memory_manager.h"
|
2018-10-31 16:51:31 +08:00
|
|
|
#include "public/cl_ext_private.h"
|
2019-07-18 06:07:10 +08:00
|
|
|
#include "runtime/helpers/mem_properties_parser_helper.h"
|
2018-09-05 16:10:26 +08:00
|
|
|
#include "runtime/mem_obj/mem_obj.h"
|
2018-09-17 20:03:37 +08:00
|
|
|
#include "runtime/memory_manager/memory_manager.h"
|
2018-09-05 16:10:26 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "CL/cl.h"
|
|
|
|
#include "mem_obj_types.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;
|
|
|
|
|
2019-08-28 16:38:29 +08:00
|
|
|
static bool validateMemoryPropertiesForBuffer(const MemoryProperties &properties, cl_mem_flags flags, cl_mem_flags_intel flagsIntel);
|
2019-08-29 14:59:15 +08:00
|
|
|
static bool validateMemoryPropertiesForImage(const MemoryProperties &properties, cl_mem parent);
|
2019-09-25 15:08:41 +08:00
|
|
|
static bool parseUnifiedMemoryProperties(cl_mem_properties_intel *properties, SVMAllocsManager::UnifiedMemoryProperties &unifiedMemoryProperties);
|
2019-08-29 14:59:15 +08:00
|
|
|
static AllocationProperties getAllocationPropertiesWithImageInfo(ImageInfo &imgInfo, bool allocateMemory, const MemoryPropertiesFlags &memoryProperties);
|
|
|
|
static bool checkMemFlagsForSubBuffer(cl_mem_flags flags);
|
|
|
|
static SVMAllocsManager::SvmAllocationProperties getSvmAllocationProperties(cl_mem_flags flags);
|
2019-10-08 16:38:02 +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:
|
2019-03-12 21:19:01 +08:00
|
|
|
static bool validateExtraMemoryProperties(const MemoryProperties &properties);
|
2018-09-05 16:10:26 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|