Skip to content

Commit 1679846

Browse files
Add api specific config for allocation cache
Currently disabled for both opencl and level zero Related-To: NEO-6893 Signed-off-by: Dominik Dabek <[email protected]>
1 parent 09bb076 commit 1679846

File tree

10 files changed

+40
-4
lines changed

10 files changed

+40
-4
lines changed

level_zero/core/source/helpers/api_specific_config_l0.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
3131
}
3232
}
3333

34+
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
35+
return false;
36+
}
37+
3438
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
3539
return ApiSpecificConfig::L0;
3640
}

level_zero/core/test/unit_tests/sources/helper/api_specific_config_l0_tests.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ TEST(ApiSpecificConfigL0Tests, givenMaxAllocSizeWhenGettingReducedMaxAllocSizeTh
4141
TEST(ApiSpecificConfigL0Tests, WhenGettingRegistryPathThenL0RegistryPathIsReturned) {
4242
EXPECT_STREQ(L0::registryPath, ApiSpecificConfig::getRegistryPath());
4343
}
44+
45+
TEST(ApiSpecificConfigL0Tests, WhenCheckingIfDeviceAllocationCacheIsEnabledThenReturnFalse) {
46+
EXPECT_FALSE(ApiSpecificConfig::isDeviceAllocationCacheEnabled());
47+
}
48+
4449
TEST(ImplicitScalingApiTests, givenLevelZeroApiUsedThenSupportEnabled) {
4550
EXPECT_TRUE(ImplicitScaling::apiSupport);
4651
}

opencl/source/helpers/api_specific_config_ocl.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
3131
}
3232
}
3333

34+
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
35+
return false;
36+
}
37+
3438
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
3539
return ApiSpecificConfig::OCL;
3640
}

opencl/test/unit_test/helpers/api_specific_config_ocl_tests.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ TEST(ApiSpecificConfigOclTests, WhenGettingRegistryPathThenOclRegistryPathIsRetu
4444
EXPECT_STREQ(oclRegPath, ApiSpecificConfig::getRegistryPath());
4545
}
4646

47+
TEST(ApiSpecificConfigOclTests, WhenCheckingIfDeviceAllocationCacheIsEnabledThenReturnFalse) {
48+
EXPECT_FALSE(ApiSpecificConfig::isDeviceAllocationCacheEnabled());
49+
}
50+
4751
TEST(ApiSpecificConfigOclTests, givenEnableStatelessCompressionWhenProvidingSvmGpuAllocationThenPreferCompressedBuffer) {
4852
DebugManagerStateRestore dbgRestorer;
4953
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);

shared/source/debug_settings/debug_variables_base.inl

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,10 @@ DECLARE_DEBUG_VARIABLE(int32_t, UsePipeControlAfterPartitionedWalker, -1, "-1: d
418418
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalSetWalkerPartitionCount, 0, "Experimental implementation: Set number of COMPUTE_WALKERs for a given Partition Type, 0 - do not set the feature.")
419419
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalSetWalkerPartitionType, -1, "Experimental implementation: Set COMPUTE_WALKER Partition Type. Valid values for types from 1 to 3")
420420
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalEnableCustomLocalMemoryAlignment, 0, "Align local memory allocations to a given value. Works only with allocations at least as big as the value. 0: no effect, 2097152: 2 megabytes, 1073741824: 1 gigabyte")
421+
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalEnableDeviceAllocationCache, -1, "Experimentally enable allocation cache.")
421422
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableSourceLevelDebugger, false, "Experimentally enable source level debugger.")
422423
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableL0DebuggerForOpenCL, false, "Experimentally enable debugging OCL with L0 Debug API.")
423424
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableTileAttach, false, "Experimentally enable attaching to tiles (subdevices).")
424-
DECLARE_DEBUG_VARIABLE(bool, ExperimentalEnableDeviceAllocationCache, false, "Experimentally enable allocation cache.")
425425

426426
/*DRIVER TOGGLES*/
427427
DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger")

shared/source/helpers/api_specific_config.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ struct ApiSpecificConfig {
1717
static bool isBcsSplitWaSupported();
1818
static bool getHeapConfiguration();
1919
static bool getBindlessConfiguration();
20+
static bool isDeviceAllocationCacheEnabled();
2021
static ApiType getApiType();
2122
static std::string getName();
2223
static uint64_t getReducedMaxAllocSize(uint64_t maxAllocSize);

shared/source/memory_manager/unified_memory_manager.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "shared/source/command_stream/command_stream_receiver.h"
1111
#include "shared/source/helpers/aligned_memory.h"
12+
#include "shared/source/helpers/api_specific_config.h"
1213
#include "shared/source/helpers/memory_properties_helpers.h"
1314
#include "shared/source/memory_manager/memory_manager.h"
1415
#include "shared/source/os_interface/hw_info_config.h"
@@ -137,9 +138,12 @@ void SVMAllocsManager::makeInternalAllocationsResident(CommandStreamReceiver &co
137138

138139
SVMAllocsManager::SVMAllocsManager(MemoryManager *memoryManager, bool multiOsContextSupport)
139140
: memoryManager(memoryManager), multiOsContextSupport(multiOsContextSupport) {
140-
if (DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get()) {
141+
this->usmDeviceAllocationsCacheEnabled = NEO::ApiSpecificConfig::isDeviceAllocationCacheEnabled();
142+
if (DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get() != -1) {
143+
this->usmDeviceAllocationsCacheEnabled = !!DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get();
144+
}
145+
if (this->usmDeviceAllocationsCacheEnabled) {
141146
this->initUsmDeviceAllocationsCache();
142-
this->usmDeviceAllocationsCacheEnabled = true;
143147
}
144148
}
145149

shared/test/common/helpers/api_specific_config_shared_tests.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ bool ApiSpecificConfig::getBindlessConfiguration() {
2727
}
2828
}
2929

30+
bool ApiSpecificConfig::isDeviceAllocationCacheEnabled() {
31+
return false;
32+
}
33+
3034
ApiSpecificConfig::ApiType ApiSpecificConfig::getApiType() {
3135
return apiTypeForUlts;
3236
}

shared/test/common/test_files/igdrcl.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ FailBuildProgramWithStatefulAccess = -1
441441
ForceUncachedGmmUsageType = 0
442442
OverrideDeviceName = unk
443443
EnablePrivateBO = 0
444-
ExperimentalEnableDeviceAllocationCache = 0
444+
ExperimentalEnableDeviceAllocationCache = -1
445445
OverrideL1CachePolicyInSurfaceStateAndStateless = -1
446446
EnableBcsSwControlWa = -1
447447
ExperimentalEnableL0DebuggerForOpenCL = 0

shared/test/unit_test/memory_manager/unified_memory_manager_cache_tests.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616

1717
using namespace NEO;
1818

19+
TEST(SvmDeviceAllocationCacheTest, givenAllocationCacheDefaultWhenCheckingIfEnabledThenItIsDisabled) {
20+
std::unique_ptr<UltDeviceFactory> deviceFactory(new UltDeviceFactory(1, 1));
21+
RootDeviceIndicesContainer rootDeviceIndices = {mockRootDeviceIndex};
22+
std::map<uint32_t, DeviceBitfield> deviceBitfields{{mockRootDeviceIndex, mockDeviceBitfield}};
23+
auto device = deviceFactory->rootDevices[0];
24+
auto svmManager = std::make_unique<MockSVMAllocsManager>(device->getMemoryManager(), false);
25+
ASSERT_EQ(DebugManager.flags.ExperimentalEnableDeviceAllocationCache.get(), -1);
26+
EXPECT_FALSE(svmManager->usmDeviceAllocationsCacheEnabled);
27+
}
28+
1929
struct SvmDeviceAllocationCacheSimpleTestDataType {
2030
size_t allocationSize;
2131
void *allocation;

0 commit comments

Comments
 (0)