2022-02-04 13:50:19 +00:00
|
|
|
/*
|
2023-01-23 18:44:33 +00:00
|
|
|
* Copyright (C) 2022-2023 Intel Corporation
|
2022-02-04 13:50:19 +00:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
|
|
|
|
|
2022-06-27 14:58:29 +00:00
|
|
|
namespace CacheSettings {
|
2022-12-08 14:23:49 +00:00
|
|
|
inline constexpr uint32_t unknownMocs = GMM_RESOURCE_USAGE_UNKNOWN;
|
2022-06-27 14:58:29 +00:00
|
|
|
} // namespace CacheSettings
|
|
|
|
|
|
2022-02-04 13:50:19 +00:00
|
|
|
namespace NEO {
|
|
|
|
|
enum class AllocationType;
|
2022-02-09 18:03:05 +00:00
|
|
|
struct HardwareInfo;
|
2023-01-23 18:44:33 +00:00
|
|
|
class ProductHelper;
|
2023-09-13 08:37:04 +00:00
|
|
|
struct RootDeviceEnvironment;
|
2022-02-04 13:50:19 +00:00
|
|
|
|
2022-02-08 17:15:22 +00:00
|
|
|
struct CacheSettingsHelper {
|
2023-01-23 18:44:33 +00:00
|
|
|
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper);
|
2022-02-08 17:15:22 +00:00
|
|
|
|
2022-04-13 13:47:52 +00:00
|
|
|
static constexpr bool isUncachedType(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType) {
|
|
|
|
|
return ((gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC) ||
|
|
|
|
|
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED) ||
|
|
|
|
|
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 08:37:04 +00:00
|
|
|
static bool preferNoCpuAccess(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType, const RootDeviceEnvironment &rootDeviceEnvironment);
|
2023-05-15 13:22:05 +00:00
|
|
|
|
2022-02-08 17:15:22 +00:00
|
|
|
protected:
|
2023-01-23 18:44:33 +00:00
|
|
|
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper);
|
2022-02-08 17:15:22 +00:00
|
|
|
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType);
|
|
|
|
|
};
|
2022-02-04 13:50:19 +00:00
|
|
|
} // namespace NEO
|