Skip to content

Commit cc72428

Browse files
refactor: cleanup includes
Signed-off-by: Jaroslaw Warchulski <[email protected]>
1 parent 48cf53e commit cc72428

17 files changed

+72
-43
lines changed

shared/source/direct_submission/direct_submission_hw.inl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,23 @@
66
*/
77

88
#include "shared/source/command_container/command_encoder.h"
9-
#include "shared/source/command_stream/command_stream_receiver.h"
109
#include "shared/source/command_stream/submissions_aggregator.h"
1110
#include "shared/source/debug_settings/debug_settings_manager.h"
12-
#include "shared/source/device/device.h"
1311
#include "shared/source/direct_submission/direct_submission_hw.h"
1412
#include "shared/source/direct_submission/relaxed_ordering_helper.h"
1513
#include "shared/source/execution_environment/execution_environment.h"
1614
#include "shared/source/execution_environment/root_device_environment.h"
17-
#include "shared/source/gmm_helper/gmm_helper.h"
18-
#include "shared/source/gmm_helper/gmm_lib.h"
1915
#include "shared/source/helpers/aligned_memory.h"
2016
#include "shared/source/helpers/compiler_product_helper.h"
21-
#include "shared/source/helpers/definitions/command_encoder_args.h"
2217
#include "shared/source/helpers/flush_stamp.h"
2318
#include "shared/source/helpers/gfx_core_helper.h"
24-
#include "shared/source/helpers/hw_info.h"
2519
#include "shared/source/helpers/ptr_math.h"
2620
#include "shared/source/memory_manager/allocation_properties.h"
2721
#include "shared/source/memory_manager/graphics_allocation.h"
2822
#include "shared/source/memory_manager/memory_manager.h"
2923
#include "shared/source/memory_manager/memory_operations_handler.h"
3024
#include "shared/source/os_interface/os_context.h"
3125
#include "shared/source/os_interface/product_helper.h"
32-
#include "shared/source/utilities/cpu_info.h"
3326

3427
#include "create_direct_submission_hw.inl"
3528

shared/source/direct_submission/direct_submission_relaxed_ordering.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "shared/source/direct_submission/direct_submission_hw.h"
9+
#include "shared/source/gmm_helper/gmm_helper.h"
910

1011
namespace NEO {
1112
template <typename GfxFamily, typename Dispatcher>

shared/source/gen12lp/state_base_address_gen12lp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "shared/source/gen12lp/hw_cmds_base.h"
9+
#include "shared/source/gmm_helper/gmm_lib.h"
910
#include "shared/source/helpers/state_base_address_base.inl"
1011

1112
namespace NEO {

shared/source/gmm_helper/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ set(NEO_CORE_GMM_HELPER
2020
${CMAKE_CURRENT_SOURCE_DIR}/gmm_helper.h
2121
${CMAKE_CURRENT_SOURCE_DIR}/gmm_interface.h
2222
${CMAKE_CURRENT_SOURCE_DIR}/gmm_lib.h
23+
${CMAKE_CURRENT_SOURCE_DIR}/gmm_resource_usage_type.h
2324
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}gmm_utils.cpp
2425
${CMAKE_CURRENT_SOURCE_DIR}/gmm_wrappers.cpp
2526
${CMAKE_CURRENT_SOURCE_DIR}/page_table_mngr.h

shared/source/gmm_helper/cache_settings_helper.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99

1010
#include "shared/source/debug_settings/debug_settings_manager.h"
1111
#include "shared/source/execution_environment/root_device_environment.h"
12+
#include "shared/source/gmm_helper/gmm_lib.h"
1213
#include "shared/source/helpers/cache_policy.h"
13-
#include "shared/source/helpers/gfx_core_helper.h"
14+
#include "shared/source/helpers/debug_helpers.h"
1415
#include "shared/source/helpers/hw_info.h"
1516
#include "shared/source/memory_manager/allocation_type.h"
16-
#include "shared/source/memory_manager/graphics_allocation.h"
1717
#include "shared/source/os_interface/product_helper.h"
18-
#include "shared/source/release_helper/release_helper.h"
18+
1919
namespace NEO {
2020

21-
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper, const HardwareInfo *hwInfo) {
21+
GmmResourceUsageType CacheSettingsHelper::getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper, const HardwareInfo *hwInfo) {
2222
if (debugManager.flags.ForceUncachedGmmUsageType.get()) {
2323
UNRECOVERABLE_IF(allocationType == AllocationType::unknown);
2424
if ((1llu << (static_cast<int64_t>(allocationType) - 1)) & debugManager.flags.ForceUncachedGmmUsageType.get()) {
@@ -33,7 +33,14 @@ GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getGmmUsageType(AllocationType
3333
}
3434
}
3535

36-
bool CacheSettingsHelper::preferNoCpuAccess(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType, const RootDeviceEnvironment &rootDeviceEnvironment) {
36+
bool CacheSettingsHelper::isUncachedType(GmmResourceUsageType gmmResourceUsageType) {
37+
return ((gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC) ||
38+
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED) ||
39+
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) ||
40+
(gmmResourceUsageType == GMM_RESOURCE_USAGE_SURFACE_UNCACHED));
41+
}
42+
43+
bool CacheSettingsHelper::preferNoCpuAccess(GmmResourceUsageType gmmResourceUsageType, const RootDeviceEnvironment &rootDeviceEnvironment) {
3744
if (debugManager.flags.EnableCpuCacheForResources.get()) {
3845
return false;
3946
}
@@ -47,7 +54,7 @@ bool CacheSettingsHelper::preferNoCpuAccess(GMM_RESOURCE_USAGE_TYPE_ENUM gmmReso
4754
return (gmmResourceUsageType != GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER);
4855
}
4956

50-
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper, const HardwareInfo *hwInfo) {
57+
GmmResourceUsageType CacheSettingsHelper::getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper, const HardwareInfo *hwInfo) {
5158
if (debugManager.flags.ForceGmmSystemMemoryBufferForAllocations.get()) {
5259
UNRECOVERABLE_IF(allocationType == AllocationType::unknown);
5360
if ((1llu << (static_cast<int64_t>(allocationType))) & debugManager.flags.ForceGmmSystemMemoryBufferForAllocations.get()) {
@@ -110,7 +117,7 @@ GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCaching
110117
}
111118
}
112119

113-
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType, const ProductHelper &productHelper) {
120+
GmmResourceUsageType CacheSettingsHelper::getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType, const ProductHelper &productHelper) {
114121
switch (allocationType) {
115122
case AllocationType::preemption:
116123
return GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC;
@@ -123,7 +130,7 @@ GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCaching
123130
}
124131

125132
// Set 2-way coherency for allocations which are not aligned to cacheline
126-
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getGmmUsageTypeForUserPtr(bool isCacheFlushRequired, const void *userPtr, size_t size, const ProductHelper &productHelper) {
133+
GmmResourceUsageType CacheSettingsHelper::getGmmUsageTypeForUserPtr(bool isCacheFlushRequired, const void *userPtr, size_t size, const ProductHelper &productHelper) {
127134
if (debugManager.flags.Disable2WayCoherencyOverride.get()) {
128135
return GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER;
129136
}

shared/source/gmm_helper/cache_settings_helper.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,32 @@
66
*/
77

88
#pragma once
9-
#include "shared/source/gmm_helper/gmm_lib.h"
9+
#include "shared/source/gmm_helper/gmm_resource_usage_type.h"
10+
11+
#include <cstdint>
12+
#include <stddef.h>
1013

1114
namespace CacheSettings {
1215
inline constexpr uint32_t unknownMocs = -1;
1316
} // namespace CacheSettings
1417

1518
namespace NEO {
19+
1620
enum class AllocationType;
1721
struct HardwareInfo;
1822
class ProductHelper;
1923
struct RootDeviceEnvironment;
2024

2125
struct CacheSettingsHelper {
22-
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper, const HardwareInfo *hwInfo);
23-
static GMM_RESOURCE_USAGE_TYPE_ENUM getGmmUsageTypeForUserPtr(bool isCacheFlushRequired, const void *userPtr, size_t size, const ProductHelper &productHelper);
26+
static GmmResourceUsageType getGmmUsageType(AllocationType allocationType, bool forceUncached, const ProductHelper &productHelper, const HardwareInfo *hwInfo);
27+
static GmmResourceUsageType getGmmUsageTypeForUserPtr(bool isCacheFlushRequired, const void *userPtr, size_t size, const ProductHelper &productHelper);
2428

25-
static constexpr bool isUncachedType(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType) {
26-
return ((gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC) ||
27-
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED) ||
28-
(gmmResourceUsageType == GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) ||
29-
(gmmResourceUsageType == GMM_RESOURCE_USAGE_SURFACE_UNCACHED));
30-
}
29+
static bool isUncachedType(GmmResourceUsageType gmmResourceUsageType);
3130

32-
static bool preferNoCpuAccess(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsageType, const RootDeviceEnvironment &rootDeviceEnvironment);
31+
static bool preferNoCpuAccess(GmmResourceUsageType gmmResourceUsageType, const RootDeviceEnvironment &rootDeviceEnvironment);
3332

3433
protected:
35-
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper, const HardwareInfo *hwInfo);
36-
static GMM_RESOURCE_USAGE_TYPE_ENUM getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType, const ProductHelper &productHelper);
34+
static GmmResourceUsageType getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper, const HardwareInfo *hwInfo);
35+
static GmmResourceUsageType getDefaultUsageTypeWithCachingDisabled(AllocationType allocationType, const ProductHelper &productHelper);
3736
};
3837
} // namespace NEO

shared/source/gmm_helper/client_context/gmm_client_context.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99
#include "shared/source/gmm_helper/gmm_lib.h"
10+
#include "shared/source/gmm_helper/gmm_resource_usage_type.h"
1011

1112
#include <functional>
1213
#include <memory>
@@ -25,8 +26,8 @@ class GmmClientContext {
2526
MOCKABLE_VIRTUAL ~GmmClientContext();
2627
MOCKABLE_VIRTUAL void initialize(const RootDeviceEnvironment &rootDeviceEnvironment);
2728

28-
MOCKABLE_VIRTUAL MEMORY_OBJECT_CONTROL_STATE cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage);
29-
MOCKABLE_VIRTUAL uint32_t cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage, bool compressed, bool cacheable);
29+
MOCKABLE_VIRTUAL MEMORY_OBJECT_CONTROL_STATE cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GmmResourceUsageType usage);
30+
MOCKABLE_VIRTUAL uint32_t cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GmmResourceUsageType usage, bool compressed, bool cacheable);
3031

3132
MOCKABLE_VIRTUAL GMM_RESOURCE_INFO *createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams);
3233
MOCKABLE_VIRTUAL GMM_RESOURCE_INFO *copyResInfoObject(GMM_RESOURCE_INFO *pSrcRes);

shared/source/gmm_helper/client_context/gmm_client_context_base.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace NEO {
1313
GmmClientContext::GmmClientContext() = default;
1414
GmmClientContext::~GmmClientContext() = default;
1515

16-
MEMORY_OBJECT_CONTROL_STATE GmmClientContext::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GMM_RESOURCE_USAGE_TYPE usage) {
17-
return clientContext->CachePolicyGetMemoryObject(pResInfo, usage);
16+
MEMORY_OBJECT_CONTROL_STATE GmmClientContext::cachePolicyGetMemoryObject(GMM_RESOURCE_INFO *pResInfo, GmmResourceUsageType usage) {
17+
return clientContext->CachePolicyGetMemoryObject(pResInfo, static_cast<GMM_RESOURCE_USAGE_TYPE_ENUM>(usage));
1818
}
1919

2020
GMM_RESOURCE_INFO *GmmClientContext::createResInfoObject(GMM_RESCREATE_PARAMS *pCreateParams) {
@@ -41,9 +41,9 @@ uint8_t GmmClientContext::getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FOR
4141
return clientContext->GetMediaSurfaceStateCompressionFormat(format);
4242
}
4343

44-
uint32_t GmmClientContext::cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GMM_RESOURCE_USAGE_TYPE usage, bool compressed, bool cacheable) {
44+
uint32_t GmmClientContext::cachePolicyGetPATIndex(GMM_RESOURCE_INFO *gmmResourceInfo, GmmResourceUsageType usage, bool compressed, bool cacheable) {
4545
bool outValue = compressed;
46-
uint32_t patIndex = clientContext->CachePolicyGetPATIndex(gmmResourceInfo, usage, &outValue, cacheable);
46+
uint32_t patIndex = clientContext->CachePolicyGetPATIndex(gmmResourceInfo, static_cast<GMM_RESOURCE_USAGE_TYPE_ENUM>(usage), &outValue, cacheable);
4747

4848
DEBUG_BREAK_IF(outValue != compressed);
4949

shared/source/gmm_helper/gmm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "shared/source/memory_manager/definitions/storage_info.h"
2323

2424
namespace NEO {
25-
Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage,
25+
Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, GmmResourceUsageType gmmResourceUsage,
2626
const StorageInfo &storageInfo, const GmmRequirements &gmmRequirements) : gmmHelper(gmmHelper) {
2727
resourceParams.Type = RESOURCE_BUFFER;
2828
resourceParams.Format = GMM_FORMAT_GENERIC_8BIT;
@@ -37,7 +37,7 @@ Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_
3737
}
3838
}
3939

40-
resourceParams.Usage = gmmResourceUsage;
40+
resourceParams.Usage = static_cast<GMM_RESOURCE_USAGE_TYPE_ENUM>(gmmResourceUsage);
4141
resourceParams.Flags.Info.Linear = 1;
4242

4343
this->preferNoCpuAccess = CacheSettingsHelper::preferNoCpuAccess(gmmResourceUsage, gmmHelper->getRootDeviceEnvironment());
@@ -165,7 +165,7 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo, bool preferCompressed) {
165165
auto &productHelper = gmmHelper->getRootDeviceEnvironment().getHelper<ProductHelper>();
166166
resourceParams.NoGfxMemory = 1; // dont allocate, only query for params
167167

168-
resourceParams.Usage = CacheSettingsHelper::getGmmUsageType(AllocationType::image, false, productHelper, gmmHelper->getHardwareInfo());
168+
resourceParams.Usage = static_cast<GMM_RESOURCE_USAGE_TYPE_ENUM>(CacheSettingsHelper::getGmmUsageType(AllocationType::image, false, productHelper, gmmHelper->getHardwareInfo()));
169169

170170
resourceParams.Format = static_cast<GMM_RESOURCE_FORMAT>(imgInfo.surfaceFormat->gmmSurfaceFormat);
171171
resourceParams.Flags.Gpu.Texture = 1;

shared/source/gmm_helper/gmm.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#pragma once
99
#include "shared/source/gmm_helper/gmm_lib.h"
10+
#include "shared/source/gmm_helper/gmm_resource_usage_type.h"
1011

1112
#include <cstdint>
1213
#include <memory>
@@ -45,7 +46,7 @@ class Gmm {
4546
Gmm() = delete;
4647
Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, const StorageInfo &storageInfo, bool preferCompressed);
4748
Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment,
48-
GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, const StorageInfo &storageInfo, const GmmRequirements &gmmRequirements);
49+
GmmResourceUsageType gmmResourceUsage, const StorageInfo &storageInfo, const GmmRequirements &gmmRequirements);
4950
Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm);
5051
Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm, bool openingHandle);
5152

0 commit comments

Comments
 (0)