Skip to content

Commit 8363740

Browse files
performance: Cache timestamps on CPU
Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent c90f3fc commit 8363740

File tree

13 files changed

+35
-33
lines changed

13 files changed

+35
-33
lines changed

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ inline std::unique_ptr<Gmm> DrmMemoryManager::makeGmmIfSingleHandle(const Alloca
19801980
gmmRequirements.allowLargePages = true;
19811981
gmmRequirements.preferCompressed = allocationData.flags.preferCompressed;
19821982

1983-
if (productHelper.overrideAllocationCacheable(allocationData)) {
1983+
if (productHelper.overrideAllocationCpuCacheable(allocationData)) {
19841984
gmmRequirements.overriderCacheable.enableOverride = true;
19851985
gmmRequirements.overriderCacheable.value = true;
19861986
}

shared/source/os_interface/product_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class ProductHelper {
196196
virtual uint32_t getMaxNumSamplers() const = 0;
197197
virtual uint32_t getCommandBuffersPreallocatedPerCommandQueue() const = 0;
198198
virtual uint32_t getInternalHeapsPreallocated() const = 0;
199-
virtual bool overrideAllocationCacheable(const AllocationData &allocationData) const = 0;
199+
virtual bool overrideAllocationCpuCacheable(const AllocationData &allocationData) const = 0;
200200
virtual bool is2MBLocalMemAlignmentEnabled() const = 0;
201201

202202
virtual bool getFrontEndPropertyScratchSizeSupport() const = 0;

shared/source/os_interface/product_helper.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ uint64_t ProductHelperHw<gfxProduct>::getDeviceMemoryMaxBandWidthInBytesPerSecon
219219
}
220220

221221
template <PRODUCT_FAMILY gfxProduct>
222-
bool ProductHelperHw<gfxProduct>::overrideAllocationCacheable(const AllocationData &allocationData) const {
222+
bool ProductHelperHw<gfxProduct>::overrideAllocationCpuCacheable(const AllocationData &allocationData) const {
223223
return false;
224224
}
225225

shared/source/os_interface/product_helper_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class ProductHelperHw : public ProductHelper {
137137
uint32_t getMaxNumSamplers() const override;
138138
uint32_t getCommandBuffersPreallocatedPerCommandQueue() const override;
139139
uint32_t getInternalHeapsPreallocated() const override;
140-
bool overrideAllocationCacheable(const AllocationData &allocationData) const override;
140+
bool overrideAllocationCpuCacheable(const AllocationData &allocationData) const override;
141141
bool is2MBLocalMemAlignmentEnabled() const override;
142142

143143
bool getFrontEndPropertyScratchSizeSupport() const override;

shared/source/os_interface/windows/wddm_memory_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryUsingKmdAndMapItToC
234234
GmmRequirements gmmRequirements{};
235235
gmmRequirements.allowLargePages = allowLargePages;
236236
gmmRequirements.preferCompressed = allocationData.flags.preferCompressed;
237-
if (productHelper.overrideAllocationCacheable(allocationData)) {
237+
if (productHelper.overrideAllocationCpuCacheable(allocationData)) {
238238
gmmRequirements.overriderCacheable.enableOverride = true;
239239
gmmRequirements.overriderCacheable.value = true;
240240
}
@@ -464,7 +464,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(co
464464
GmmRequirements gmmRequirements{};
465465
gmmRequirements.allowLargePages = true;
466466
gmmRequirements.preferCompressed = false;
467-
if (productHelper.overrideAllocationCacheable(allocationData)) {
467+
if (productHelper.overrideAllocationCpuCacheable(allocationData)) {
468468
gmmRequirements.overriderCacheable.enableOverride = true;
469469
gmmRequirements.overriderCacheable.value = true;
470470
}

shared/source/xe2_hpg_core/lnl/os_agnostic_product_helper_lnl.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace NEO {
1313

1414
template <>
15-
bool ProductHelperHw<gfxProduct>::overrideAllocationCacheable(const AllocationData &allocationData) const {
16-
return allocationData.type == AllocationType::commandBuffer || this->overrideCacheableForDcFlushMitigation(allocationData.type);
15+
bool ProductHelperHw<gfxProduct>::overrideAllocationCpuCacheable(const AllocationData &allocationData) const {
16+
return allocationData.type == AllocationType::commandBuffer || allocationData.type == AllocationType::timestampPacketTagBuffer || this->overrideCacheableForDcFlushMitigation(allocationData.type);
1717
}
1818

1919
template <>

shared/source/xe3_core/ptl/os_agnostic_product_helper_ptl.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
namespace NEO {
1111

1212
template <>
13-
bool ProductHelperHw<gfxProduct>::overrideAllocationCacheable(const AllocationData &allocationData) const {
14-
return allocationData.type == AllocationType::commandBuffer || this->overrideCacheableForDcFlushMitigation(allocationData.type);
13+
bool ProductHelperHw<gfxProduct>::overrideAllocationCpuCacheable(const AllocationData &allocationData) const {
14+
return allocationData.type == AllocationType::commandBuffer || allocationData.type == AllocationType::timestampPacketTagBuffer || this->overrideCacheableForDcFlushMitigation(allocationData.type);
1515
}
1616

1717
template <>

shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ bool ProductHelperHw<gfxProduct>::isDeviceUsmPoolAllocatorSupported() const {
7373
}
7474

7575
template <>
76-
bool ProductHelperHw<gfxProduct>::overrideAllocationCacheable(const AllocationData &allocationData) const {
76+
bool ProductHelperHw<gfxProduct>::overrideAllocationCpuCacheable(const AllocationData &allocationData) const {
7777
return allocationData.type == AllocationType::commandBuffer;
7878
}
7979

shared/test/common/mocks/mock_product_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct MockProductHelper : ProductHelperHw<IGFX_UNKNOWN> {
1717
MockProductHelper() = default;
1818

1919
ADDMETHOD_CONST_NOBASE(is48bResourceNeededForRayTracing, bool, true, ());
20-
ADDMETHOD_CONST_NOBASE(overrideAllocationCacheable, bool, false, (const AllocationData &allocationData));
20+
ADDMETHOD_CONST_NOBASE(overrideAllocationCpuCacheable, bool, false, (const AllocationData &allocationData));
2121
ADDMETHOD_NOBASE(configureHwInfoWddm, int, 0, (const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, const RootDeviceEnvironment &rootDeviceEnvironment));
2222
ADDMETHOD_CONST_NOBASE(supportReadOnlyAllocations, bool, false, ());
2323
ADDMETHOD_CONST_NOBASE(isBlitCopyRequiredForLocalMemory, bool, true, (const RootDeviceEnvironment &rootDeviceEnvironment, const GraphicsAllocation &allocation));

shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022-2024 Intel Corporation
2+
* Copyright (C) 2022-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -142,11 +142,11 @@ TEST_F(WddmMemoryManagerTests, GivenNotCompressedAndNotLockableAllocationTypeWhe
142142
memoryManager->freeGraphicsMemory(graphicsAllocation);
143143
}
144144

145-
TEST_F(WddmMemoryManagerTests, GivenOverrideAllocationCacheableWhenAllocateUsingKmdAndMapToCpuVaThenOverrideAllocationCacheable) {
145+
TEST_F(WddmMemoryManagerTests, GivenoverrideAllocationCpuCacheableWhenAllocateUsingKmdAndMapToCpuVaThenoverrideAllocationCpuCacheable) {
146146
NEO::AllocationData allocData = {};
147147
allocData.type = NEO::AllocationType::commandBuffer;
148148
auto mockProductHelper = std::make_unique<MockProductHelper>();
149-
mockProductHelper->overrideAllocationCacheableResult = true;
149+
mockProductHelper->overrideAllocationCpuCacheableResult = true;
150150
executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper.release());
151151

152152
memoryManager->callBaseAllocateGraphicsMemoryUsingKmdAndMapItToCpuVA = true;

0 commit comments

Comments
 (0)