2022-02-04 21:50:19 +08:00
|
|
|
/*
|
2023-01-24 02:44:33 +08:00
|
|
|
* Copyright (C) 2022-2023 Intel Corporation
|
2022-02-04 21:50:19 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
|
|
|
|
2022-06-27 22:58:29 +08:00
|
|
|
namespace CacheSettings {
|
2022-12-08 22:23:49 +08:00
|
|
|
inline constexpr uint32_t unknownMocs = GMM_RESOURCE_USAGE_UNKNOWN;
|
2022-06-27 22:58:29 +08:00
|
|
|
} // namespace CacheSettings
|
|
|
|
|
2022-02-04 21:50:19 +08:00
|
|
|
namespace NEO {
|
|
|
|
enum class AllocationType;
|
2022-02-10 02:03:05 +08:00
|
|
|
struct HardwareInfo;
|
2023-01-24 02:44:33 +08:00
|
|
|
class ProductHelper;
|
2022-02-04 21:50:19 +08:00
|
|
|
|
2022-02-09 01:15:22 +08:00
|
|
|
struct CacheSettingsHelper {
|
2023-01-24 02:44:33 +08:00
|
|
|
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper);
|
2022-02-09 01:15:22 +08:00
|
|
|
|
2022-04-13 21:47:52 +08: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));
|
|
|
|
}
|
|
|
|
|
2022-02-09 01:15:22 +08:00
|
|
|
protected:
|
2023-01-24 02:44:33 +08:00
|
|
|
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper);
|
2022-02-09 01:15:22 +08:00
|
|
|
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType);
|
|
|
|
};
|
2022-02-04 21:50:19 +08:00
|
|
|
} // namespace NEO
|